5 Years
Discussion Span
Last Post by adam_k

The datagrid gets its result set from the database so maybe you may want to try searching the database table and if the result is found, you point to the record on the datagrid.

Imports System.Data.OleDb

Public Class Form1 Inherits System.Windows.Forms.Form

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click

    cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;_
	Data Source=C:\emp.mdb;")
'provider to be used when working with access database

cn.Open() 'open connection 
cmd = New OleDbCommand("select * from table1 where columnname = '"+ textbox1.text + "'", cn)

dr = cmd.ExecuteReader
While dr.Read()
' loading data into datagrid
End While

Catch ex as exception 

End Try



End Sub

End Class

ahhhh where to put that codes you give sir?., look at my project can u help me finish that?.


Follow all events accordingly. The codes under the Button1_Click event should be pasted in your search button


sir, compile error sub or function not defined. i put the code in the search command button.
whats the problem now?


you're not to copy all the codes under the search button. The codes under the Form1_load should be placed under your own form load event and those under the button1_click even t should be under your search button. It works well for me without errors


sir can u put the codes u gave for me?. then re upload it. pls? thanks in advanced sorry im newbie in vb ., i can't understand the codes u gave,


sir can u arrange the code u gave for me.. and then re upload it. sorry im cant understand the code u gave cause im new to vb.. download my proj and re upload it please? thanks.


sir i follow the what u said.. and i got too many error.. ahhh why is that? "compile error list seperator or ) "


If I'm not mistaken, your first print screen shows VB6 in the background.
Can you please let us know what VB you are using for this project?


Friend, I don't think Netcode's solution will work for you, as it is written for VB.Net (This post has been created in the VB.Net portion of the site)

Please search the Visual Basic 4/5/6 section of the forum for a solution to your question and if you can't find what you are looking for then create a thread in that section. I'm sure your answer will be answered quickly and correctly if you post in the appropriate section.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.