How do you give the user a choice of settings?
i.e. Value1, value2, value3
or 0 - Flat 1 - 3D
You know in one of those little dropdown box's
Printable View
How do you give the user a choice of settings?
i.e. Value1, value2, value3
or 0 - Flat 1 - 3D
You know in one of those little dropdown box's
The way we get in VB intellisense?
Use Enums
Code:Public Enum MakeChoice
LowLevel =0
HighLevel = 1
End Enum
You could create a poropertypage.
I geuss I should have said ActiveX Control or User Control
I also need to know where to put the "Enums"
Here's some of my code
VB Code:
Private Sub UserControl_InitProperties() Caption = Ambient.DisplayName End Sub 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=Label1,Label1,-1,ForeColor Public Property Get FontColor() As OLE_COLOR FontColor = Label1.ForeColor End Property Public Property Let FontColor(ByVal New_ForeColor As OLE_COLOR) Label1.ForeColor() = New_ForeColor PropertyChanged "FontColor" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=Label1,Label1,-1,Font Public Property Get Font() As Font Set Font = Label1.Font End Property Public Property Set Font(ByVal New_Font As Font) Set Label1.Font = New_Font PropertyChanged "Font" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=Label1,Label1,-1,Caption Public Property Get Caption() As String Caption = Label1.Caption End Property Public Property Let Caption(ByVal New_Caption As String) Label1.Caption() = New_Caption PropertyChanged "Caption" End Property 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! 'MappingInfo=Check1,Check1,-1,Value Public Property Get FontStyle() As Integer FontStyle = Check1.Value End Property Public Property Let FontStyle(ByVal New_Style As Integer) Check1.Value() = New_Style PropertyChanged "FontStyle" End Property 'Load property values from storage Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Label1.ForeColor = PropBag.ReadProperty("FontColor", &H80000012) Set Label1.Font = PropBag.ReadProperty("Font", Ambient.Font) Label1.Caption = PropBag.ReadProperty("Caption", "Label1") Check1.Value = PropBag.ReadProperty("FontStyle", 1) End Sub 'Write property values to storage Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("ForeColor", Label1.ForeColor, &H80000012) Call PropBag.WriteProperty("Font", Label1.Font, Ambient.Font) Call PropBag.WriteProperty("Caption", Label1.Caption, "Label1") Call PropBag.WriteProperty("FontStyle", Check1.Value, 1) End Sub
Using Enums:
VB Code:
Public Enum MyEnum End Enum
Using Enums:
VB Code:
Public Enum MyEnum FirstValue = 1 SecondValue = 2 End Enum Public Function MyFun(byval VauesExpected as MyEnum) as Whatever 'Code end Function
If you want to name an enum that is normally invalid (e.g 3D or a name with spaces such as Fixed Single) enclose the value in square brackets: -
Public MyEnum
None
[Fixed Single]
End Enum
Public MyEnum2
Flat
[3D]
End Enum
The above are of course 0 and 1 in each case but you can number them as you wish like the MousePointer property in most controls has a Custom property equal to 99 - just specify this in the enum : -
Public MyEnum3
Default
.
.
.
[Size All]
Custom = 99
End Enum
(Sorry don't know how to indent)