By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,661 Members | 781 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,661 IT Pros & Developers. It's quick & easy.

DataGridView Questions

P: n/a
I have a couple questions regarding the DataGridView object...

1) What is the underlying data type that the DataGridView uses if you
are using it unbound and do for instance dgv.Columns.Add(). Is there
any way to access that data type directly, since the DataSource field
is null when the DataGridView is unbound?

2) Is there any way to add a row which does not have as many columns
as the rest of the grid? Basically I have about 10 columns of data
but every so often I want to put an "event" row in the table to show
where an event happened. I pretty much just want that event row to
have 2 columns, one to say the time the event happened and another
with the description of the event. Is this possible in the
DataGridView object, or if not then is it possible in any other native
C# object that I can display in a DataGridView type fashion?

Thanks in advance,
Stu
Nov 19 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
st*******@gmail.com schrieb:
1) What is the underlying data type that the DataGridView uses if you
are using it unbound and do for instance dgv.Columns.Add(). Is there
any way to access that data type directly, since the DataSource field
is null when the DataGridView is unbound?
I am nearly ONLY using unbound grids, but that question never came to my
mind. I usually find that if I _presume_ the underlying datatype to be
of type "string" as long as it is undefined, then I don't have problems.
but every so often I want to put an "event" row in the table to show
where an event happened. I pretty much just want that event row to
have 2 columns, one to say the time the event happened and another
with the description of the event.
Maybe a "ListView" control can even do better what you want. If you want
to stick to the DataGridView you can use the CellPaint-Events to
determine which type of row is displayed.
I never touched the borders of cells for such a purpose, but it should
be possible to make the cell-borders of neighbouring cells disappear in
the beforecellpaint event, for each row that is of type "event".
Nov 20 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.