How can i display data to datagridview based on the selected text in my drop down list which is a te

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
How can i display data to datagridview based on the selected text in my drop down list which is a text box,
here is my code ..
Private Sub FillSearchResult()<br/>
<br/>
Dim AutoComp As New AutoCompleteStringCollection()<br/>
Dim dsSerch As New DataSet<br/>
<br/>
Dim ConStr As String = "Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|GuidanceDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"<br/>
Dim sqlCon As New SqlClient.SqlConnection(ConStr)<br/>
Dim Str As String = "Select Surname from StudentInfo"<br/>
Dim SqlCom As New SqlClient.SqlCommand(Str, sqlCon)<br/>
Dim sqlAdap As New SqlClient.SqlDataAdapter(SqlCom)<br/>
<br/>
SqlCom.Connection = sqlCon<br/>
<br/>
sqlCon.Open()<br/>
<br/>
sqlAdap.Fill(dsSerch)<br/>
For i As Integer = 0 To dsSerch.Tables(0).Rows.Count - 1<br/>
AutoComp.Add(dsSerch.Tables(0).Rows(i)(0).ToString())<br/>
Next<br/>
txtSearch.AutoCompleteMode = AutoCompleteMode.Suggest<br/>
txtSearch.AutoCompleteSource = AutoCompleteSource.CustomSource<br/>
txtSearch.AutoCompleteCustomSource = AutoComp<br/>
End Sub
what i want is to show the data of the selected last name from the list ..
please help me ..
thank you ..



View the full article
 
Back
Top