0

hi, all i need to add combobox in datagridview.
actually i have 3 fields in database which are
Sid Fee status
what i want to add combo column in field [status] with two option PAID or UNPAID which a user can select and update it .
i am all clear with filling the datagridview from database and updating but only problem is adding a combobox in third field that is status.

i tried it with this

Dim combo As DataGridViewComboBoxColumn 

DataGridView1.Columns("combo")

combo.Items.Add("PAID")

combo.Items.Add("UNPAID")

above code add the column with combobox but not with field status but as a fourth column which i does not require i need to add it at third field . i am sure you guys can help.
thanks in advance

Edited by ayesha789: n/a

3
Contributors
2
Replies
18
Views
7 Years
Discussion Span
Last Post by darthswift00
1

Take a look at code snippet,

Dim dt As New Data.DataTable
        dt.Columns.Add("Name")
        dt.Columns.Add("Status")
        dt.Rows.Add("A", "Paid")
        dt.Rows.Add("B", "Unpaid")

        DataGridView1.AutoGenerateColumns = False
        DataGridView1.DataSource = dt

        Dim Name As New DataGridViewTextBoxColumn
        Name.DataPropertyName = "Name"

        Dim Status As New DataGridViewComboBoxColumn
        Status.DataPropertyName = "Status"
        Status.Items.Add("Paid")
        Status.Items.Add("Unpaid")

        DataGridView1.Columns.Add(Name)
        DataGridView1.Columns.Add(Status)
0

Hi, i have a similar problem as i want to use a combo box to display all the information of a particular album(DVD or CD) which i use to link to my database and to click the search button to display the relative information about the album.

However when i load the form, it does not show the information. how can i display my information of my album using a combo box and datagrid?

I have attached to zip folders;
1. PDL Testing SQL(My database)
2. testing forms pdl(My project the form is called"Search collection test.vb") Thats what my question is all about.

Thanks God Bless

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.