|
-
Jan 17th, 2001, 05:05 AM
#1
Thread Starter
Lively Member
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.
-
Jan 17th, 2001, 07:06 AM
#2
Fanatic Member
In your DLL form, add the code to the Click event of the buttons:
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
Then in your DLL class the following function will initiate the form, then return the button text.
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
This function should return "OK" or "Cancelled"
Hope that this helps
-
Jan 17th, 2001, 08:08 AM
#3
Thread Starter
Lively Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|