datagrideviewComboboxColumn

  • Thread starter Thread starter MohammadGalouzlee
  • Start date Start date
M

MohammadGalouzlee

Guest
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.







Continue reading...
 
Back
Top