have two form
in one form i salect some thing and click on done button a mesage box prompt me that u selcet this and this

and on the other form a button result is place.. when i click on it a new form appears and the msg box text that appears on msg box appears in label which is on 3rd form... now what i do .. its not run first i do simple coading but i think its nt rgt

'for first form 
Dim p As Integer
Private Sub Command1_Click()
p = MsgBox("thanku your text box value is" & vbCr & Text1.Text)
End Sub 

'form 3rd form
Dim p As String
Private Sub Form_Load()
Label1.Caption = Form1.p
End Sub

its say method and data member not found its means all code is wrong what i do now... plzzz telll me .. rply fast

yes, what you are trying to do is not supported.

Hi,


Your code should look like this :

'for first form 
Public Function GetMessageVal() As String
    GetMessageVal = InputBox("Enter New Value")
End Function
 
 
'form 3rd form
Private Sub Form_Load()
Label1.Caption = Form1.GetMessageVal
End Sub

Regards
Veena

'form 3rd form
Dim p As String
Private Sub Form_Load()
Label1.Caption = Form1.p
End Sub

You're using private variables from another form. If you want to use the variables from another form, you must declare those variables as Public and not Private.

Once you use Form1 followed by the period, then anything after the period belongs to the object Form1 and not to the form that you are currently on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.