Hi,
What is the best way to transfer variables to and from a dialog box? My
project consists of a form with a number of controls, lets say three Labels,
when a label is clicked it opens a dialog box with a text box in it and the
text box data will be returned to the label that was clicked. Don't laugh
but this is the code I use, it's OK for three controls but gets complicated
when using alot of controls and although it works I think its not the best
way. Any advice greatly appreciated.
Many thanks
Richard.
General Declarations:
---------------------------------------------------------------------
Public myLabel1 As String
Public myLabel2 As String
Public myLabel3 As String
Public myLabelNumber As Integer
---------------------------------------------------------------------
Form1 Events:
---------------------------------------------------------------------
Private Sub Label1_Click()
myLabelNumber = 1
Dialog.Show
End Sub
---------------------------------------------------------------------
Private Sub Label2_Click()
myLabelNumber = 2
Dialog.Show
End Sub
---------------------------------------------------------------------
Private Sub Label3_Click()
myLabelNumber = 3
Dialog.Show
End Sub
---------------------------------------------------------------------
Dialog Events:
---------------------------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
Select Case myLabelNumber
Case 1
Form1.Label1.Caption = Text1
Case 2
Form1.Label2.Caption = Text1
Case 3
Form1.Label3.Caption = Text1
End Select
End Sub
---------------------------------------------------------------------
Private Sub OKButton_Click()
Unload Dialog
End Sub
---------------------------------------------------------------------