hi.
so my module class (dll),
is calling form1.show,
which have ok and cancel buttons,
(the reason i made form for that is i wanted it topmost).
how do i get which button was pressed?
(and ofcourse the dll "waits" until button click)
thanks.
itay.
Printable View
hi.
so my module class (dll),
is calling form1.show,
which have ok and cancel buttons,
(the reason i made form for that is i wanted it topmost).
how do i get which button was pressed?
(and ofcourse the dll "waits" until button click)
thanks.
itay.
In your DLL form, add the code to the Click event of the buttons:
Then in your DLL class the following function will initiate the form, then return the button text.Code:Private Sub cmdOK_Click()
'If OK was clicked
Me.Tag = "OK"
Me.Hide
End Sub
Private Sub cmdCancel_Click()
'If Cancel was clicked
Me.Tag = "Cancelled"
Me.Hide
End Sub
This function should return "OK" or "Cancelled"Code:Public Function ShowMyForm(ByVal strText As String) As String
'// Form1 is the form with an OK & Cancel button
Set mForm = New Form1
With mForm
.Tag = "Loaded"
.Label1.Caption = "strText" 'message to display"
.Show vbModal 'your topmost routine in Form_Load event
ShowMyForm = .Tag
End With
Unload mForm
Set mForm = Nothing
End Function
Hope that this helps :cool:
thanks.
very simple indeed.
my original (wrong) thought was to put public variable
on the module and update it from the form,
but the correct solution is the other way around :)
-i.