Hi All Brothers

I am working on ERP system and i need one help

I wrote code for Datagrid auto complete.

this code is working perfect but it only showing one Column record from database

what i need is

i want first column is to autocomplete as i did and it should fill related columns automatically linked with first column.

please guide me with Codes

many Thanks

My Code

    Dim strConn As String
    Dim da As SqlDataAdapter
    Dim conn As SqlConnection
    Dim ds As New DataSet
    strConn = ("Server= DESKTOP-QN6F623; Database = stock_in;Integrated Security = false;User ID=dis;Password=0m3rP@ss")
    conn = New SqlConnection(strConn)
    da = New SqlDataAdapter("Select * from [items]", conn)
    da.Fill(ds, "items")
    ItemsDataGridView.DataSource = ds.Tables("items")

    Dim cmd As New SqlCommand("Select item_number From items", conn)
    Dim dr As SqlDataReader

    conn.Open()
    dr = cmd.ExecuteReader
    Do While dr.Read
        scAutoComplete.Add(dr.GetString(0))
    Loop
    conn.Close()

Private Sub ItemsDataGridView_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles ItemsDataGridView.EditingControlShowing

    If ItemsDataGridView.CurrentCell.ColumnIndex = 1 AndAlso TypeOf e.Control Is TextBox Then
        With DirectCast(e.Control, TextBox)
            .AutoCompleteMode = AutoCompleteMode.SuggestAppend
            .AutoCompleteSource = AutoCompleteSource.CustomSource
            .AutoCompleteCustomSource = scAutoComplete
        End With

    Else

        With DirectCast(e.Control, TextBox)
            .AutoCompleteMode = Nothing

            .AutoCompleteSource = AutoCompleteSource.CustomSource
            .AutoCompleteCustomSource = Nothing

        End With

    End If

End Sub

As I read the first section of code, Line 11 reads as if your record set "might" give you a set with one item. Use your SQLfoo (your SQL command line skills) to test this out. Again, all looks as the code is fine and doing what you asked in Line 11.

Thanks bro for your reply.....but can you write some code for me please that will be great help

The problem with me writing code is twofold. First if you don't understand your code at line 11, how would you know what my code is doing?
Second, only you know what you wanted your app to do.