Property editor

  • Thread starter Thread starter JC Voon
  • Start date Start date
J

JC Voon

Hi:

My component has a property which type is control, i want it to accept
only textbox and combobox, how to tell the properties windows, when
drop down or set the property, it only show or accept the textbox and
combobox control ?

Thanks
JCVoon
 
JC Voon said:
My component has a property which type is control, i want it to accept
only textbox and combobox, how to tell the properties windows, when
drop down or set the property, it only show or accept the textbox and
combobox control ?

All you can do (AFAIK) is checking the class name of the assigned value:

\\\
Private m_TheControl As Control

Public Property TheControl() As Control
Get
Return m_TheControl
End Get
Set(ByVal Value As Control)
If TypeOf Value Is TextBox OrElse TypeOf Value Is ComboBox Then
m_TheControl = Value
Else
Throw _
New ArgumentException( _
"The control must be either a textbox or combobox." _
)
End If
End Set
End Property
///
 
Herfried, I noticed us used the ArgumentException Class to throw an
exception. This was new to me and in reading the documentation on it, I am
having trouble understanding the difference between this and just throw new
exception. Is there a real difference in that both can pass an exception
message? I would appreciate your insight as to the difference. Thanks.
 

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

Back
Top