•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 402,003 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,414 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 2605 | Replies: 7
![]() |
•
•
Join Date: Mar 2007
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
There are many ways,
You could have a global variable in your second form to store which option was selected. Then just have a PUBLIC method in your second form called getSelected which returns your option
then as long as you open the second form modally, the first form will wait for the second form to close before executing the rest of the code.
or for VB2005
will open it in Modal
Hope this helps
You could have a global variable in your second form to store which option was selected. Then just have a PUBLIC method in your second form called getSelected which returns your option
public function getSelected()
return selection
end functionthen as long as you open the second form modally, the first form will wait for the second form to close before executing the rest of the code.
form2.show vbModal
option = form2.getSelected()
form2.dispose()
or for VB2005
form2.showDialog()
option = form2.getSelected()
form2.dispose()
will open it in Modal
Hope this helps
•
•
Join Date: Mar 2007
Posts: 59
Reputation:
Rep Power: 2
Solved Threads: 5
Make a public form variable in the second form.
Load the second form modally.
Pass the value to the form as a propertie.
If you are ready in the form close is
The form properties stay preserved.
Do with them what you want (e.q. in the fist form).
Then, unload the second form.
'In Form1
Form2.Show vbModal
MsgBox "We still have the string: " & form2.my_second_string
Unload Form2
'Here Form2 is destroyed; with it the (public) string
'In Form2
Public My_Second_String as String
Private Sub Test()
My_Second_String = "The_Second_String"
Form2.hide
'Returns us to Form1, beyond: Form2.Show vbModal
'Preserve the string to take it to Form1
End Sub
--or--------------------------------------------------
'In Form1
Form2.Load
Form2.My_Second_String = "From Form1 to Form2"
Form2.Show
'in Form2
Public My_Second_String As String
Private Sub Test()
My_Second_String = "The_Second_String"
Form2.Hide
'returns us to Form1, beyond: Form2.Show vbModal
End Sub
(not tested!)
Load the second form modally.
Pass the value to the form as a propertie.
If you are ready in the form close is
The form properties stay preserved.
Do with them what you want (e.q. in the fist form).
Then, unload the second form.
'In Form1
Form2.Show vbModal
MsgBox "We still have the string: " & form2.my_second_string
Unload Form2
'Here Form2 is destroyed; with it the (public) string
'In Form2
Public My_Second_String as String
Private Sub Test()
My_Second_String = "The_Second_String"
Form2.hide
'Returns us to Form1, beyond: Form2.Show vbModal
'Preserve the string to take it to Form1
End Sub
--or--------------------------------------------------
'In Form1
Form2.Load
Form2.My_Second_String = "From Form1 to Form2"
Form2.Show
'in Form2
Public My_Second_String As String
Private Sub Test()
My_Second_String = "The_Second_String"
Form2.Hide
'returns us to Form1, beyond: Form2.Show vbModal
End Sub
(not tested!)
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- load data from access database into form (VB.NET)
- Pass data to MessageBox (VB.NET)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: where is wrong?
- Next Thread: Reading from non existant Text file


Linear Mode