Tablet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Back
Top