Add Custom User Control in the DatagridView Column

Hema Rawat

Member
Joined
Dec 12, 2005
Messages
24
Location
India
Programming Experience
1-3
[FONT=Verdana, Geneva, Arial, Sans-serif]Hi All,[/FONT]
[FONT=Verdana, Geneva, Arial, Sans-serif]I m stuck with a problem[/FONT]
[FONT=Verdana, Geneva, Arial, Sans-serif]Can any body solve my problem ,[/FONT]
[FONT=Verdana, Geneva, Arial, Sans-serif]The problem is how we can add the custom control in the datagrid view column[/FONT]
[FONT=Verdana, Geneva, Arial, Sans-serif]Means i want to show aa user control in the a datagrid view column lik ethe simple combo box , button etc,[/FONT]
[FONT=Verdana, Geneva, Arial, Sans-serif]Thanks for ur great help in advance [/FONT]
 
hi JohnH
Thanks for the link

But I have seen that link
& also implemented th same for the multi column combo box
But i m not succeeeded yet.?????
Although i does not give error
it only shows the drop down arrow of the combo box
but do not shows the items in that & neither it drop down..

I can't understand that wat is the problem

Plz help me
if u can do something in that?


Thanks a lot.

With Regards
Hema
 
http://www.codeproject.com/cs/miscctrl/datagridcomboboxcolumn.asp

Your problem sounds like the combobox has not been assigned a dataset or table to get the values from.

note this text from the thread above:

VB.NET:
Create the DataGridComboBoxColumn and add it to the GridColumnStyles. 
The first argument (Type) is used for the column caption and the mapping. 
(Could be changed after creating). 
The second argument (AccessDataTypes) is the DataTable to use for translation. 
Name and Number are the column names to use from the table and theGrid is the DataGrid where this column will belong to. 
Be sure to provide the NullText ; if you don't it will throw an exception if you try to add a row to the DataGrid.

[COLOR=Green]DataGridComboBoxColumn c1=new DataGridComboBoxColumn("Type", AccessDataTypes, "Name", "Number", theGrid);
c1.NullText="3";
ts.GridColumnStyles.Add(c1);[/COLOR]
 
http://www.codeproject.com/cs/miscctrl/datagridcomboboxcolumn.asp

Your problem sounds like the combobox has not been assigned a dataset or table to get the values from.

note this text from the thread above:

VB.NET:
Create the DataGridComboBoxColumn and add it to the GridColumnStyles. 
The first argument (Type) is used for the column caption and the mapping. 
(Could be changed after creating). 
The second argument (AccessDataTypes) is the DataTable to use for translation. 
Name and Number are the column names to use from the table and theGrid is the DataGrid where this column will belong to. 
Be sure to provide the NullText ; if you don't it will throw an exception if you try to add a row to the DataGrid.

[COLOR=Green]DataGridComboBoxColumn c1=new DataGridComboBoxColumn("Type", AccessDataTypes, "Name", "Number", theGrid);
c1.NullText="3";
ts.GridColumnStyles.Add(c1);[/COLOR]
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21237693.html
 
Back
Top