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.

use the same dataset in the second form (by reference)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MajorTom - 14 Jan 2005 16:29 GMT
Hello everybody,

I need help on how to use the same datase in two different form, this is the
scenario:
at the first form I load a big dataset (ds1) for short, but I not want to
load it again at the second form
at some point I use a second form

Form f = new FormX();
f.ShowDialog();

at the f form I need to use ds1, and I have the same ds1 in the f form

I tried assigning public access for f.ds1
and do like this:

Form f = new FormX();
f.ds1 = this.ds1;
f.ShowDialog();

also I tried passing it at the constructor like this:

Form f = new FormX(ds1);
f.ShowDialog();

all the time the dataset ds1 at the second form have no rows
the only way I get the record is using the merge method this way

Form f = new FormX();
f.ds1.Merge(this.ds1);
f.ShowDialog();

but it take the time for filling the dataset f.ds1 again
the solution that I need is to use the same dataset or at least not take the
time for load it again

Thanks for your help

MajorTom
Maqsood Ahmed - 16 Jan 2005 06:41 GMT
Hello!
I believe you might want a class which can contain the dataset in it and
then form1 and form2 both use the same dataset using its property. Also
try to use DataSet.Copy method while getting the DataSet from the class.
Cheers :)

Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
MajorTom - 17 Jan 2005 01:33 GMT
Thanks, I will try thath way

MajorTom

> Hello!
> I believe you might want a class which can contain the dataset in it and
[quoted text clipped - 8 lines]
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for 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.