am working on a stock management system and i added textbox with autocomplete codes..i have two forms one is items form and other is stock in. now i can able to get itemcodeID from stockin itemnumber textbox with autocomplete codes but when i select that item number its not giving me the description..i mean to say that if user search itemcode in stock in form then he should get description and quantity of that item automatically... i am using vb.net and ms sql . What I have tried: <pre>Private Sub getData(ByVal dataCollection As AutoCompleteStringCollection) Dim connetionString As String = Nothing Dim connection As SqlConnection Dim command As SqlCommand Dim adapter As New SqlDataAdapter() Dim ds As New DataSet() connetionString = ("Server= DESKTOP-QN6F623; Database = dbo_main;Integrated Security = false;User ID=dis;Password=0m3rP@ss") Dim sql As String = "SELECT itemnumber FROM items" connection = New SqlConnection(connetionString) Try connection.Open() command = New SqlCommand(sql, connection) adapter.SelectCommand = command adapter.Fill(ds) adapter.Dispose() command.Dispose() connection.Close() For Each row As DataRow In ds.Tables(0).Rows dataCollection.Add(row(0).ToString()) Next Catch ex As Exception MessageBox.Show("Can not open connection ! ") End Try End Sub
Private Sub stockin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Stockin_itemnumberTextBox.AutoCompleteMode = AutoCompleteMode.Suggest Stockin_itemnumberTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource Dim DataCollection As New AutoCompleteStringCollection() getData(DataCollection) Stockin_itemnumberTextBox.AutoCompleteCustomSource = DataCollection End Sub
itemnumber
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)