Code:
Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick Try Dim dt As New DataTable 'Dim dr As DataRow dp = "Provider=Microsoft.Jet.OLEDB.4.0;" src = "Data source=c:\Database\licdb.mdb" con.ConnectionString = dp & src con.Open() 'db() query = "select * from year2008 where id = '" & id & "'" da = New OleDb.OleDbDataAdapter(query, con) da.Fill(ds1, "tab") da.Fill(dt) TextBox1.Text = ds1.Tables("tab").Rows(id).Item(1).ToString() TextBox2.Text = ds1.Tables("tab").Rows(id).Item(2).ToString() TextBox3.Text = ds1.Tables("tab").Rows(id).Item(3).ToString() TextBox4.Text = ds1.Tables("tab").Rows(id).Item(4).ToString() TextBox5.Text = ds1.Tables("tab").Rows(id).Item(5).ToString() TextBox14.Text = ds1.Tables("tab").Rows(id).Item(6).ToString() TextBox7.Text = ds1.Tables("tab").Rows(id).Item(7).ToString() TextBox8.Text = ds1.Tables("tab").Rows(id).Item(8).ToString() TextBox9.Text = ds1.Tables("tab").Rows(id).Item(9).ToString() TextBox10.Text = ds1.Tables("tab").Rows(id).Item(10).ToString() TextBox16.Text = ds1.Tables("tab").Rows(id).Item(11).ToString() TextBox11.Text = ds1.Tables("tab").Rows(id).Item(12).ToString() TextBox17.Text = ds1.Tables("tab").Rows(id).Item(13).ToString() con.Close() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) Me.Close() End Try End Sub
Comment