Samir Junaid Samir Junaid - 10 days ago 5
Vb.net Question

Datagrid on VB.net auto complete the other column?

I have a datagrid and I have imported it to my project under vb.net language, and the database is MS access...

any way in this datagrid one table call

"Employees"

ID - Name - Nationality - Job title

and what I want is when I write the ID number of the Employee, all the other details automatically comes upon to his ID number.

Answer

I found near answer I made it by my self ... But it shown the result in combobox not text box :'(

    Dim dgvc1 As New DataGridViewComboBoxColumn()
    Dim index1 As Integer = DataGridView1.Columns.IndexOf(DataGridView1.Columns("code"))
    Dim index11 As Integer = DataGridView1.Columns.IndexOf(DataGridView1.Columns("nu"))
    Dim index111 As Integer = DataGridView1.Columns.IndexOf(DataGridView1.Columns("aaa"))
    Dim dgvc11 As New DataGridViewComboBoxColumn()



    dgvc1.Name = "Code Meaning"
    dgvc1.DataPropertyName = "nu"
    dgvc1.ValueMember = "nu"
    dgvc1.DisplayMember = "code"
    dgvc1.DataSource = CodesTableAdapter.GetData()


    dgvc1.SortMode = DataGridViewColumnSortMode.Automatic


    If DataGridView1.Columns.Contains(dgvc1) = False Then
        DataGridView1.Columns.Insert(index1, dgvc1)
    Else
    End If

    dgvc1.ReadOnly = True
    dgvc1.Width = 250




    dgvc11.Name = "meaning total"
    dgvc11.DataPropertyName = "nu"
    dgvc11.ValueMember = "nu"
    dgvc11.DisplayMember = "aaa"
    dgvc11.DataSource = CodesTableAdapter.GetData()


    dgvc11.SortMode = DataGridViewColumnSortMode.Automatic


    If DataGridView1.Columns.Contains(dgvc11) = False Then
        DataGridView1.Columns.Insert(index111, dgvc11)
    Else
    End If

    dgvc11.ReadOnly = True
    dgvc11.Width = 250
    dgvc11.DefaultCellStyle.BackColor = Color.White
    dgvc11.DefaultCellStyle.ForeColor = Color.Black
Comments