TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Fruqan Yousuf
NA
1
0
Combobox in datagrid
Aug 29 2006 2:27 AM
i wanna display a combox in a datagrid. here is the main code. but i get error with message that "handle the dataerror event"
private void Form2_Load(object sender, EventArgs e)
{
System.Windows.Forms.DataGridViewComboBoxColumn Column1;
DataTable table = new DataTable("t");
table.Columns.Add("col1");
table.Columns.Add("col2");
table.Rows.Add(table.NewRow());
table.Rows.Add(table.NewRow());
table.Rows.Add(table.NewRow());
table.Rows.Add(table.NewRow());
table.Rows[0][0] = "furqan";
table.Rows[0][1] = "1";
table.Rows[1][0] = "sulman";
table.Rows[1][1] = "2";
table.Rows[2][0] = "asdfass";
table.Rows[2][1] = "3";
table.Rows[3][0] = "ghiojf";
table.Rows[3][1] = "4";
DataSet myDataSet = new DataSet("dsname");
myDataSet.Tables.Add(table);
Column1 = new System.Windows.Forms.DataGridViewComboBoxColumn();
Column1.DataSource = myDataSet.Tables[0];
Column1.ValueMember = "col2";
Column1.DisplayMember = "col1";
Column1.AutoComplete = true;
dataGridView1.Columns.Add(Column1);
DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
cell.DataSource = myDataSet.Tables[0];
cell.DisplayMember = "name";
cell.ValueMember = "id";
object[] a = new object[1];
a[0] = cell;
dataGridView1.Rows.Add(a);
}
whats the problem ???
Reply
Answers (
1
)
SMS app and the AT Commands
Reading Excel file using C#