hie
i have 3 columns in the data table.
id, name, telno.
i want to display only specific names and telno. depending on the charactes the users inputs in the text box.
this part has been taken care of.
wht i need to do now is, i want to display only name and telno. and i do not want to display id.
is this possible in dataview

Add unbounded columns.

you want me to add unbounded columns to the datatable?

Add TextBox1 and DataGridView1 Control.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dt As New DataTable
        dt.Columns.Add("No", GetType(Int32))
        dt.Columns.Add("Name")
        dt.Columns.Add("Age")

        dt.Rows.Add(1, "A", 11)
        dt.Rows.Add(2, "B", 22)
        dt.Rows.Add(3, "C", 33)
        DataGridView1.AutoGenerateColumns = False

        Dim t1 As New DataGridViewTextBoxColumn()
        t1.DataPropertyName = "Name"
        t1.HeaderText = "Name"
        DataGridView1.Columns.Add(t1)

        Dim t2 As New DataGridViewTextBoxColumn()
        t2.DataPropertyName = "Age"
        t2.HeaderText = "Age"
        DataGridView1.Columns.Add(t2)

        DataGridView1.DataSource = dt.DefaultView
    End Sub
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        CType(DataGridView1.DataSource, DataView).RowFilter = "Name like '%" & TextBox1.Text & "%'"
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.