Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

Reuse DataGridTableStyle

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob Oldfield - 19 Jan 2005 16:59 GMT
Hi,

I have two datagrids (on the same Windows form) that are basically two
different filters of the same datatable.  I've set up a table style for the
first one and I'm then trying to reuse that same style for the second
datagrid.  That's giving the error "Cannot add a DataGridTableStyle already
parented to another DataGrid"

Any ideas how I can reuse it?
WineNCheese - 19 Jan 2005 18:27 GMT
I'm assuming you are using the same instance of the DGTS.  This cannot be
done, since the DGTS "is an object that represents the drawn grid" (from
help).  You need to create a second instance.

> Hi,
>
[quoted text clipped - 7 lines]
>
> Any ideas how I can reuse it?
Rob Oldfield - 19 Jan 2005 18:51 GMT
I get what you mean... but am not sure exactly how to do it.  I've tried
something like...

dim orig_ts as new datagridtablestyle
'set up orig_ts
dg_orig.tablestyles.add(orig_ts)  'air code... can't remember if i have the
syntax of that right

dim new_ts as new datagridtablestyle
new_ts=orig_ts
dg_new.tablestyles.add(new_ts)

I've just been thinking that maybe I should try doing the new_ts=orig_ts
before I set the style on the first datagrid.  Is that it or am I missing
something?

> I'm assuming you are using the same instance of the DGTS.  This cannot be
> done, since the DGTS "is an object that represents the drawn grid" (from
[quoted text clipped - 11 lines]
> >
> > Any ideas how I can reuse it?
WineNCheese - 19 Jan 2005 19:05 GMT
I think you'd be better off having a method that intializes a table style
the way you want, and call it with each of your table style instances (or
something along those lines).

>I get what you mean... but am not sure exactly how to do it.  I've tried
> something like...
[quoted text clipped - 28 lines]
>> >
>> > Any ideas how I can reuse it?
Rob Oldfield - 19 Jan 2005 19:37 GMT
Nice idea.  I'll give it a try tomorrow but it does seem that that should
work.

Thanks very much for the help.

> I think you'd be better off having a method that intializes a table style
> the way you want, and call it with each of your table style instances (or
[quoted text clipped - 32 lines]
> >> >
> >> > Any ideas how I can reuse it?
Rob Oldfield - 20 Jan 2005 10:06 GMT
Yup.  Just to confirm that that works nicely.  Thanks again.

> Nice idea.  I'll give it a try tomorrow but it does seem that that should
> work.
[quoted text clipped - 42 lines]
> > >> >
> > >> > Any ideas how I can reuse it?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.