Hi all, Iwant to know is there any way to add a new column in datagrid depending upon the value of a combobox. I have columns in a table whose names are same as combobox's items names. I need to add that column in datagrid which value is selected by user.
Please help me its urgent
Gaurav arora
0
Junior Poster in Training
Recommended Answers
Jump to PostHi, Use the following syntax to add Column at runtime
DataGridView1.Columns.Add ( string ColumnName, string ColumnCaption)
If your Combobox values are unique then use ComboBox selected value as Column name and Caption otherwise choose your own column name and Columncaption can be combobox value. because Columnnames are unique.
…
Jump to PostHi Gaurav
Please check the next code, to add columns to data grid view at run time from combo box
if I miss understand You, please explan and I will try to help you//============= //Form1.Designer.cs //=========== namespace WinDatagrid { partial class Form1 { /// <summary> …
Jump to Postforget you are dealing with datagrid now you are in dealing with the datatable add column add rows to it any, by mapping or select direct from a database.. any way any change in the datatable will be chnaged in datagrid cause datagrid bounded or this datatable.
I wish …
All 10 Replies
selvaganapathy
31
Posting Pro
Gaurav arora
0
Junior Poster in Training
AmirBedair
0
Light Poster
Gaurav arora
0
Junior Poster in Training
AmirBedair
0
Light Poster
Gaurav arora
0
Junior Poster in Training
karthi_selva
0
Junior Poster in Training
shilpa88
-1
Newbie Poster
sknake
commented:
unrelated to the OP
-1
Geekitygeek
480
Nearly a Posting Virtuoso
Geekitygeek
480
Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.