Create a property in usercontrol ?

A

Agnes

I create my own usercontrol ( a textbox user control) and with a new
property.
For this property , i want to let the user to choose the choice (like combox
box) during design mode . How can I do that ?
 
Z

ZorpiedoMan

Just set up an Enum with the choices:

Public Enum ChoiceType
Choice1
Choice2
Choice3
End Enum

Private myChoice as ChoiceType
Public Property ChoiceProperty as ChoiceType
Get
Return mychoice
End Get
Set(Value as Choicetype)
myChoice = value
End Set
End property


--Zorpy

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
H

Herfried K. Wagner [MVP]

* "Agnes said:
I create my own usercontrol ( a textbox user control) and with a new
property.
For this property , i want to let the user to choose the choice (like combox
box) during design mode . How can I do that ?

\\\
Public Class Foo
Inherits UserControl

Public Enum Bla
Bla1
Bla2
Bla3
End Enum

Private m_Bla As Bla
 
A

Agnes

That's great. It works ~~~
Thanks a lot
Herfried K. Wagner said:
\\\
Public Class Foo
Inherits UserControl

Public Enum Bla
Bla1
Bla2
Bla3
End Enum

Private m_Bla As Bla
.
.
.
Public Property Bla() As Bla
Get
Return m_Bla
End Get
Set(ByVal Value As Bla)
m_Bla = Value
End Set
End Property
End Class
///

Have a look at the 'System.ComponentModel' namespace and the attributes
defined in this namespace if you want to hide properties from the text
editor or add a description text, for example.
 
C

Cor Ligthert

Hi Agnes,
That's great. It works ~~~

There are not much in this newsgroup who doubt about that when Herfried has
typed in a message himself and not wrote that it was quick and dirty. (And
than mostly it works as well).

How you do recognise those

Look if he used "Foo and Bla".

:)

Cor
 
A

Agnes

Foo and Bla ?[ In fact I don't know what does it mean .]
Cor, Do u mean I am too rude to reply Herfried ?
If yes, I am sorry about that .
 
C

Cor Ligthert

Hi Agnes,
Do u mean I am too rude to reply Herfried ?

No absolute not, however I am sometimes rude to Herfried to prickle him and
to see how he acts than, this time I did want to give him an indirect
compliment and used your message for it and show you as well that most of us
who are active on this newsgroup appriciate Herfried although we are
sometimes rude to him.

(Herfried knows that when I am rude to him it has no deeper impact as well
as when Herfried does that to me)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top