Hi all,
We just posted two new whitepapers about building custom cells and columns for the DataGridView control:
Building a custom RadioButton cell and column for the DataGridView control (Source and Sample Code)
Building a custom NumericUpDown cell and column for the DataGridView control (Source and Sample Code )
The docs, source code and sample code are under http://www.windowsforms.net/WhidbeyFeatures/default.aspx PageID=2&ItemID=13&Cat=Controls&tabindex=5
Enjoy!
-Regis
Microsoft Windows Forms team
This post is provided "as-is"

New whitepapers for building DataGridView custom cells and columns
Rob Mauii
Just a quick question, before I start putting time and effort into researching and implementing something. Is it possible, or more important, is it possible without a LOT of work to implement DataGridViewCell's who's value is something more complex, ie perhaps a class of somesort
I'm wanting to create a customizeable view, using the TreeGridView, and then create some cell's that have custom painted graphics to represent various data, for example, one will store and display the last 5 values of an event I will be listening for (its a bit more complex than that but simplist way to explain). So most likely it will be storing an ArrayList or similar that will store 5 float values.
One of them will be a lot more complex than that, storing a lot of information for various different things.
Thanks for any responses :)
[edit] PS. These won't be user editable, they will be entirely driven by backend data, it will merely be a way for customers to see complex data about service information etc.
AKazi
MyForm frm = new MyForm();
void Test()
{
frm.ShowDialog();
}
void Test2()
{
frm = new MyForm()
frm.Show(); //Error
}
dush1
Hi Regis,
Will a c++ example added soon Or can you point to a c++ example that uses a class derived from an interface class in visual c++ 2005. Thanks
Regards
dave.t
Deefer
Hi Regis,
Do you have the sample code of DataGridViewNumericUpDown in vb.net
thanks you
cehlers
How we can set the default values for those
editing Control .
Like By Numberic Updown COlumn i want it starts from 1 or 10
By date calender Probelm i want to set the start default date.
How we can achieve this with these Editing Controls
How we make these Controls Also opens with the keyboard without mouse help
Thanks a lot in advance
Eylem Ugurel
Kirill Tropin
Hi Buster95,
did you manage to get the DataGridViewNumericUpDown in vb.net 2005
Can i have it
Thanks you
somebodyelse
I'm using the CalenderColumn provided from MSDN with the address http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx#Mtps_DropDownFilterText
the problem is that when I want to validate to datetime fields using CalenderColumn from RowValidating event of the datagridview, I get stucked. I validate if two datetime fields have a day difference of 1.
TimeSpan diff = seconddate.Subtract(firstdate);
if( diff.Days < 1)
{
MessageBox.Show("Second date must be greater that first date");
e.Cancel = true;
}
please try it yourself and see the result. Any idea
Stephen Todd MSFT
It worked for me.
adi151478
Hi,
Does someone has the source code in VB.Net 2005 to these two white papers
Konstantinos55265
Hi,
Also is it possible to display a local image in to textboxCell along with the data recevied from a database,
for eg i want to show a icon based on the status of the record
As far as i think: i can do it in two ways by storing the icon in sql server or else setting a flag and depending on it changing the icon(choosing frm local resource)
wats according to u is the best option; which will guarentee the better performance
Thanks in advance;
bizhaoqi
Hi Regis,
Please help me with this my project requires something similar to the post at http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=233259&SiteID=1.
The post was very help full; can u please give me some more information on how to to place a icon next to the text in a data grid view col; means the icon and text shud look in same col
// i am using VS2005; and i m aware of the datagridimage col; but it can only display image;
i hav tried with many sols provided in web but with not much luck; please help me with this
what will be the best option
Thanks in advance
engp1584
I think I have the same problem.
I’ve tried incorporating the NumeicUpDown column in a solution. The first time I show the form containing my DataGridView, it works fine. Than, I close the form and try to show it a second time, and it crashes here :
//DataGridViewNumericUpDownCell.cs
//Line 579
// Make sure the NumericUpDown control is parented to a visible control
if (paintingNumericUpDown.Parent == null || paintingNumericUpDown.Parent.Visible)
{
paintingNumericUpDown.Parent = this.DataGridView; // <==
}
It trows a ObjectDisposedException.
Stangely, I use the NumeicUpDown column on a other form and it works without a glitch.
CleverCoder
Thanks in advance,
Marc
mbmiller@micropath.com