home *** CD-ROM | disk | FTP | other *** search
- Type ObjectReferenceForm From SampleMasterForm
- Dim MyRef As Object
- Dim Button1 As New Button
- Dim BtnEnable As New Button
- Dim OptionButton1 As New OptionButton
- Dim ScrollBar1 As New ScrollBar
- Dim TextBox1 As New TextBox
- Dim CheckBox1 As New CheckBox
- Dim ComboBox1 As New ComboBox
- Dim ListBox1 As New ListBox
- Dim BtnCodeExample As New Button
-
- ' METHODS for object: ObjectReferenceForm
- Sub OptionButton1_GotFocus()
- MyRef = OptionButton1
- End Sub
-
- Sub Button1_GotFocus()
- MyRef = Button1
- End Sub
-
- Sub ScrollBar1_GotFocus()
- MyRef = ScrollBar1
- End Sub
-
- Sub Label1_GotFocus()
- MyRef = Label1
- End Sub
-
- Sub TextBox1_GotFocus()
- MyRef = TextBox1
- End Sub
-
- Sub ComboBox1_GotFocus()
- MyRef = ComboBox1
- End Sub
-
- Sub CheckBox1_GotFocus()
- MyRef = CheckBox1
- End Sub
-
- Sub ListBox1_GotFocus()
- MyRef = ListBox1
- End Sub
-
- Sub BtnEnable_Click()
- MyRef.Enabled = Not MyRef.Enabled
- End Sub
-
- Sub BtnCodeExample_Click()
- Dim b As Button
- Dim c As Control
- Dim i As Integer
-
- For i = 0 To Controls.Count - 1
- c = Controls(i)
- ' TypeOf checks to see if object is of a specific type
- If TypeOf c Is Button Then
- b = c
- Else
- ' This is like a "0" used for object references
- b = Nothing
- End If
- ' Same as saying If Not (Nothing) Then .....
- If b Then
- InfoBox.Message("", b.Caption)
- End If
- Next i
- End Sub
-
- Sub ResetApplication_Click
- Button1.Enabled = True
- TextBox1.Enabled = True
- OptionButton1.Enabled = True
- CheckBox1.Enabled = True
- ListBox1.Enabled = True
- ScrollBar1.Enabled = True
- ComboBox1.Enabled = True
- ' Check to see of the ListBox needs to be configured
- If ListBox1.ListCount == 0 Then
- ListBox1.AddItem "ListBox1"
- End If
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: ObjectReferenceForm
- '
- With ObjectReferenceForm
- .Caption := "Object Referencing Example"
- .Move(3735, 1845, 5970, 4305)
- .MyRef := ObjectReferenceForm.Button1
- With .Button1
- .Caption := "Button1"
- .Move(300, 300, 2100, 450)
- End With 'ObjectReferenceForm.Button1
- With .BtnEnable
- .Caption := "Enable/Disable"
- .Move(300, 2850, 1815, 450)
- End With 'ObjectReferenceForm.BtnEnable
- With .OptionButton1
- .Caption := "OptionButton1"
- .Move(300, 1650, 1800, 330)
- .TabStop := True
- End With 'ObjectReferenceForm.OptionButton1
- With .ScrollBar1
- .Caption := "ScrollBar1"
- .Move(3300, 2100, 2250, 285)
- .Orientation := "Horizontal"
- .Move(3300, 2100, 2250, 285)
- End With 'ObjectReferenceForm.ScrollBar1
- With .TextBox1
- .Caption := "TextBox1"
- .Move(300, 900, 2100, 450)
- End With 'ObjectReferenceForm.TextBox1
- With .CheckBox1
- .Caption := "CheckBox1"
- .Move(300, 2100, 1500, 300)
- End With 'ObjectReferenceForm.CheckBox1
- With .ComboBox1
- .Move(3300, 300, 2250, 360)
- End With 'ObjectReferenceForm.ComboBox1
- With .ListBox1
- .Caption := "ListBox1"
- .Move(3300, 900, 2250, 990)
- End With 'ObjectReferenceForm.ListBox1
- With .BtnCodeExample
- .Caption := "Code Example"
- .Move(3900, 2850, 1650, 450)
- End With 'ObjectReferenceForm.BtnCodeExample
- With .helpfile
- .FileName := "C:\ENVELOP\PROGRAM\envelop.hlp"
- End With 'ObjectReferenceForm.helpfile
- End With 'ObjectReferenceForm
- End Code
-