Imports System.Data.OleDb
Public Class Form1
Dim con As New OleDbConnection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = " Provider = microsoft.jet.oledb.4.0; data source = c:\userpass.mdb"
con.Open()
datagridShow()
End Sub
Private Sub datagridShow()
Dim ds As New DataSet
Dim dt As New DataTable
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
da = New OleDbDataAdapter("select * from userpass", con)
da.Fill(dt)
DataGridView1.DataSource = dt.DefaultView
con.Close()
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim i As Integer
i = DataGridView1.CurrentRow.Index
Me.TextBox2.Text = DataGridView1.Item(1, i).Value
End Sub
Also the "DataGridView1.Item(1, i).Value" Keeps getting highlighted it says "Implicit conversion from Object to String."
Thanks

New Topic/Question
Reply



MultiQuote






|