Hi frds,
I am presently working on Windows app...
can any body suggest me how to load combo box in dynamic datagridView and suggest me how to implement events on combo control............
Any help is appreciated
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
paul danielPosted Feb 23, 2010, 4:35 AM
http://rustemsoft.com/datagridview_columns1.htm
kiran kumarPosted Feb 22, 2010, 11:57 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace combogrid
{
public partial class Form1 : Form
{
DataGridView dv = new DataGridView();
DataGridViewComboBoxColumn cb = new DataGridViewComboBoxColumn();
string[] com = {"hi","hello" };
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.cb.HeaderText = "dynamic";
this.dv.Columns.Add(cb);
for (int i = 0; i < com.Length; i++)
{
this.cb.Items.Add(com[i]);
}
this.dv.Location = new Point(75, 74);
this.Controls.Add(dv);
dv.EditingControlShowing+=new DataGridViewEditingControlShowingEventHandler(dv_EditingControlShowing);
}
private void dv_EditingControlShowing(object sender,
DataGridViewEditingControlShowingEventArgs e)
{
ComboBox combo = e.Control as ComboBox;
if (combo != null)
{
combo.SelectedIndexChanged +=
new EventHandler(ComboBox_SelectedIndexChanged);
}
}
private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.cb.HeaderText = "event";
}
}
}
ACCEPT THE ANSWER IF IT HELPS YOU JUST CLICK ON THE ACCEPTED ANSWER CHECKBOX