|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Two forms and using functions between the two
Ok I have two different forms and I want to pass a value from one form to another. I am passing information from a sub to a function with no return.
It says my function is not declared. I dont understand what I am doing wrong I had the sub private as well as the function in the other form. But I tried making them both public and it says the same thing. Can someone please tell me how you pass values between forms. Thank you. |
|
#2
|
|||
|
|||
|
Is the function in a module?
Edit: Not entirely sure what you want to do, but this should work fine if I understood you correctly: [Form1] Code:
Private Sub Command1_Click() MsgBox LAUGH(1) End Sub Private Sub Form_Load() Form2.Show End Sub [Form2] Code:
Private Sub Command1_Click() MsgBox LAUGH(0) End Sub [Module] Code:
Public Function LAUGH(check As Integer) If check = 0 Then LAUGH = "Yes!" If check = 1 Then LAUGH = "No!" End Function Form1, Command1, when clicked will prompt a msgbox with "No!" Form2, Command1, when clicked will prompt a msgbox with "Yes!" Both use the same function, declared in the module. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Two forms and using functions between the two |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|