When I double click on a name a pop up window appears with this person's data (method show()) how can I pass a variable to that new window from the window I double clicked on?
Thanks in advance.
Printable View
When I double click on a name a pop up window appears with this person's data (method show()) how can I pass a variable to that new window from the window I double clicked on?
Thanks in advance.
like this?
VB Code:
Private Sub Label1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.DoubleClick Dim f As New Form5() f.Label1.Text = Me.Label1.Text f.Show() End Sub
Well almost, the thing is that the variable isn't to be shown it is just an internarl ID number to retriever information from a database. So i want to pass it to do, in the popping form, something like "select * from customers where idcustomers=variable".
Hey thanks.
this sample :bigyello:
in Form5:VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim f As New Form5() f.generateId(Me.TextBox1.Text) f.Show() End Sub
:bigyello:VB Code:
Dim cn As New SqlConnection("user id=sa; password=password; initial catalog=northwind") Sub generateId(ByVal s As String) Dim cmdText As String = "select* from student where Idno = '" & s & "'" cn.Open() Dim cm As New SqlCommand(cmdText, cn) Dim dr As SqlDataReader = cm.ExecuteReader While dr.Read TextBox1.Text = dr.GetValue(1).ToString 'lastname End While dr.Close() cn.Close() End Sub
alright that sure helps, thanks lots
no probs :bigyello: