Hmm, I've experimented a bit with this thing again...
As I add a new column to a DataSet bound to a DataGridView, it leads to
automatic addition of one TextBox column into the DataGridView. After using
DataGridViewCell cell = new DataGridViewComboBoxCell();
DGV.Columns["colname"].CellTemplate = cell;
I encounter an error message "Value for the property CellTemplate has to
be of the Windows.Forms.DataGridViewTextBoxCell type or has to be
derived from this type." (I'm sorry for the translation, but the
original error message was not in English)
I wonder, am I able to change the column type upon it's automatic
creation? I guess not. How could I change the column type then? I should
definitely not add any new columns to the DataGridView as I'd have two
brand new columns instead of one then...
Maybe I could still create the column myself, remove the automatically
created one and set the data binding, but that doesn't seem to me as a
good solution. There must be a simple way how to do this...
Any ideas?
With regards
nvx
nvx napsal(a):
> Hi,
> how can I change a DataGridViewTextBoxColumn to a
[quoted text clipped - 4 lines]
> With regards
> nvx
edgarrolla@yahoo.com.br - 25 Jul 2006 14:36 GMT
Same problem over here! If you guys find any alternative way, please
don't forget to post it here! :D
> nvx napsal(a):
> > Hi,
[quoted text clipped - 5 lines]
> > With regards
> > nvx
Paul Jones - 25 Jul 2006 14:44 GMT
I had this problem in the past for a few times too. Then I stopped using
the DB designer in VS2005 and started writing my own code for working
with DB. This way I can define the type of a column as I wish before I
add it to the DataGridView and bind it to the DB table's column.
P.J.
edgarrolla@yahoo.com.br napsal(a):
> Same problem over here! If you guys find any alternative way, please
> don't forget to post it here! :D
[quoted text clipped - 8 lines]
>>> With regards
>>> nvx