Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

datagrideviewComboboxColumn

$
0
0

hi

I have one form have one  button and one datagrideview with two column  .Name and Title . the title column add programmatically.

here is code in load

DataGridViewComboBoxColumncombo2 =newDataGridViewComboBoxColumn();

 combo2.HeaderText = "Title";

combo2.Items.Add("Sir");

combo2.Items.Add("Lady");

combo2.Items.Add("Doctor");

dataGridView1.Columns.Insert(1, combo2);

now when we run program the datagri... title column contains sir,lady,doctor.

 imagine when program is running ,datagrideview has two row like this

Name            Title

Alex

Katty

 title column is empty . now when we click button , title of first row become Sir and second row become lady like this

Name            Title

Alex              Sir

Katty             Lady

how can I do this?

with combobox control I can do it like this

comboBox1.SelectedIndex = comboBox1.Items.IndexOf("Sir");

 but with datagrideviewcomboboxcolumn I could not do this.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>