cheers,
regards.
this is d form1 button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click form2.show() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click form3.show() End Sub
this is d form2 n 3
Private Sub form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.mdb"
con.Open()
sql = "SELECT * FROM Agent"
sql2 = "SELECT * FROM PO"
da = New OleDb.OleDbDataAdapter(sql, con)
da1 = New OleDb.OleDbDataAdapter(sql2, con)
da.Fill(ds, "KDE")
da1.Fill(ds2, "KDE1")
con.Close()
MaxRows1 = ds.Tables("KDE").Rows.Count
MaxRows2 = ds2.Tables("KDE1").Rows.Count
inc = 0
Getdata()
TextBox1.Enabled = "false"
TextBox2.Enabled = "false"
TextBox3.Enabled = "False"
TextBox4.Enabled = "false"
'DataGridView1.Visible = "false"
End Sub
Sub Getdata()
TextBox1.Text = ds.Tables("KDE").Rows(0).Item(0)
TextBox2.Text = ds.Tables("KDE").Rows(0).Item(1)
TextBox3.Text = ds.Tables("KDE").Rows(0).Item(2)
TextBox4.Text = ds.Tables("KDE").Rows(0).Item(3)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'For c1 = 0 To (MaxRows1 - 1) 'notice starts at zero and to one less than the number of rows in the table
'If CStr(ds2.Tables("KDE1").Rows(c1).Item(1)) = Cust Then
'CustomerFound = True
'total = +ds2.Tables("KDE1").Rows(c1).Item(10)
' End If
' Next
' TextBox5.Text = total
Dim testdt As testDataSet.PODataTable
With Me.DataGridView1
.SelectionMode = DataGridViewSelectionMode.FullRowSelect
.MultiSelect = False
End With
Dim testda As New testDataSetTableAdapters.POTableAdapter
Dim c1 As Integer 'counter for loop
Dim Cust As String
Dim CustomerFound As Boolean = False
Dim total As Integer
Dim total1 As Integer
Dim total2 As Integer
Dim total3 As Integer
Dim total4 As Integer
Dim total5 As Integer
Dim total6 As Integer
Cust = TextBox1.Text
testdt = testda.GetData
DataGridView1.DataSource = testdt
If TextBox1.Text = "" Then
MsgBox("Please Insert A Member ID")
Else
testdt.DefaultView.RowFilter = "Agent= '" & TextBox1.Text & "'"
For c1 = 0 To (MaxRows2 - 1) 'notice starts at zero and to one less than the number of rows in the table
If CStr(ds2.Tables("KDE1").Rows(c1).Item(1)) = Cust Then
CustomerFound = True
total += ds2.Tables("KDE1").Rows(c1).Item(10)
total1 += ds2.Tables("KDE1").Rows(c1).Item(17)
total2 += ds2.Tables("KDE1").Rows(c1).Item(24)
total3 += ds2.Tables("KDE1").Rows(c1).Item(31)
total4 += ds2.Tables("KDE1").Rows(c1).Item(38)
total5 += ds2.Tables("KDE1").Rows(c1).Item(45)
End If
Next
TextBox5.Text = total
TextBox6.Text = total1
TextBox7.Text = total2
TextBox8.Text = total3
TextBox9.Text = total4
TextBox10.Text = total5
total6 = +TextBox5.Text + TextBox6.Text + TextBox7.Text + TextBox8.Text + TextBox9.Text + TextBox10.Text
TextBox11.Text = total
End If
End Sub
i just wana make like i click button1 in form1,it will pop out form2 wit related data..thx!

New Topic/Question
Reply




MultiQuote






|