Tall Dude

I don't make too many user controls, but when I do I

cannot get the results I want using the USERCONTROL

component in the toolbox.

So.... My question applies only to a usercontrol created

in a class library in Visual Basic Express Edition.

I manually add all the needed 'add reference' s and imports

statements that are needed.

Now. Using only the above software and technique.

How do you lock or hide a property that you have set

in a 'class made' user control

In the code below, the class will create a multiline textbox.

When the control is added to a form, the multiline property

is still visible and changable. How do you lock or hide it

Again, this is a stand alone class to create a dll, not part of

a larger project or part of a 'Windows Application'.

Code Snippet

Imports System.Windows.Forms

Public Class TextBoxMultiLine

Inherits System.Windows.Forms.TextBox

Sub New()

MyBase.New()

Me.Multiline = True

End Sub

End Class




Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

ReneeC

See if you can overide the base class Multiline property.




Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

Tall Dude

Thanks Renee but a code example would really be nice






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

ssta

If you inherit from UserControl you can add a TextBox to the control and expose the properties that you want to. Alternativly you can use this code:

<Browsable(False)> _

Public Overrides Property Multiline() As Boolean

Get

Return MyBase.Multiline

End Get


Set(ByVal value As Boolean)

MyBase.Multiline = True

End Set

End Property


The one thing I didn't cover here is how to diable the MultiLine property in the designer.







Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

Tall Dude

Thank you for the code.

(I only want to inheriet from textbox, nothing else.)

I will be very busy today, but a quick test of your code

did not work for me.

I will re-test the code again when I am able.






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

Dave299

Browsable hides the property in the designer. You can use EditorBrowsable to hide it from Intellisense.

This seems to work ok.

Code Snippet

Public Class MyTextBox

Inherits TextBox

Public Sub New()

MyBase.New()

Multiline = True

End Sub

<Browsable(False), EditorBrowsable(EditorBrowsableState.Never)> _

Public Overrides Property Multiline() As Boolean

Get

Return MyBase.Multiline

End Get

Set(ByVal value As Boolean)

MyBase.Multiline = True

End Set

End Property

End Class





Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

Tall Dude

Thank you Ssta and Dave.

The code now works for me.

Any pointers (links) on how to manipulate a property

by moving the mouse over the control in design mode






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

Tall Dude

In case you are interested, the usercontrol (that works,) that I

am trying to improve on is at:

http://users.adelphia.net/~gcumbia/MyEyes.zip

http://users.adelphia.net/~gcumbia/MyEyes.dll

The eyes in the pic follow the mouse, even if the control

is several levels deep, the mouse is followed at all levels

and multiple controls on the same form work fine (so far!)






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

ReneeC

Stop and think about this. Size is about the only property you can manipulate with the mouse. All the rest are done via

the property sheet. That are controls like the imagelist and some panels the have smart tags but most of the time, those evoke dialogue boxes. There absolutely have to be hooks for things like that in the IDE because Microsoft's controls are not the only ones that work. There are a couple of places where you could get answers to these questions.

The less likely is the VB IDE section. Developers read that forum often. Another place, is to find developers'control projects on places like Codeplex. Send them a note and they will be able to answer your questions. It may take a little patience.






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

Tall Dude

But, if you consider the form itself as a control,

then location is also handled by the mouse in the IDE.

I was thinking about letting someone using my control,

use a different picture and re-position the eyes in the

IDE.

They are currently drawn in the IDE by my code.






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

ReneeC

There are many things that differentiate a form from other controls and I don't think you can change it's location via the mouse.






Re: Visual Basic Express Edition Hiding properties in a 'class made' usercontrol

ssta

You need to write a custom designer for the control. You might also look at control extenders @ http://msdn2.microsoft.com/en-us/library/ms229066.aspx.