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

Tablet

P: n/a
Does anyone know if it is possible to add the same tablestyle to 2 different datagrids?

i have tried the following:

DGrid1.TableStyles.Add(TSCaraBooking)
DGrid2.TableStyles.Add(TSCaraBooking)

but i get an error that tells me :

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot add a DataGridTableStyle already parented to another DataGrid.

How would i get around this?
Do i have to create the same tablestyle again but just name it something different?
Seems a clumsy way of doin it. :o)

Any advise?
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Angeliina,
Does anyone know if it is possible to add the same tablestyle to 2 different datagrids?
Based on the error you are receiving I would say its not possible!
How would i get around this? Have you considered putting the code that creates the table style into a
function, then calling the function twice?

Alternatively if I need to have the "same" grid on a form twice, I would
consider creating a new control out of the grid, either by inheriting from
the grid itself, or placing the grid on a UserControl.

Hope this helps
Jay

"Angeliina" <an*******@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com... Does anyone know if it is possible to add the same tablestyle to 2 different datagrids?
i have tried the following:

DGrid1.TableStyles.Add(TSCaraBooking)
DGrid2.TableStyles.Add(TSCaraBooking)

but i get an error that tells me :

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll Additional information: Cannot add a DataGridTableStyle already parented to another DataGrid.
How would i get around this?
Do i have to create the same tablestyle again but just name it something different? Seems a clumsy way of doin it. :o)

Any advise?

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.