473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

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
Nov 16 '05 #1
3 1516
MajorTom,

I think that you are doing something wrong if you have no rows. Can you
show some of the code, or a sample project which shows the problem? You
should just be able to share the data set normally.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MajorTom" <m.********@NOverizon.net.do> wrote in message
news:ui****************@TK2MSFTNGP15.phx.gbl...
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

Nov 16 '05 #2
Thanks for your help.

As you say that I just be able to share the dataset normally.
I check for the number of rows at the second form, and found they are there.

the problem was with my control (combobox) that don't display any rows,
datasource and all others necessary proprieties were set, but for a reason I
don't understand now, I have to set the datasource again at the load event
of the second form.

now is working ok, but when I set de datasource of the combobox

this.cboCodControl.DataSource = this.ds1inv_master1.inv_master;

I get almost the same performance problem (this is what I want to avoid),
the dataset is very big and it take some seconds processing that line of
code (or some one related)

I want to make a example project, but have to deal with a lot of SQL tables.

Is the another way for me to get the desired results

Tanks very much

MajorTom
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eE**************@TK2MSFTNGP09.phx.gbl...
MajorTom,

I think that you are doing something wrong if you have no rows. Can you show some of the code, or a sample project which shows the problem? You
should just be able to share the data set normally.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MajorTom" <m.********@NOverizon.net.do> wrote in message
news:ui****************@TK2MSFTNGP15.phx.gbl...
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


Nov 16 '05 #3
Well one thing to consider is this design.

I was writing an application recently that had an incredible amout of lookup
tables, so I needed some sort of dataset that all parts of my app could get
to to implement the combo box's datasource property.

I used a static class that held a series of static DataSets,
this allowed me to get the datasets desired without recreating a new
instance of anything at runtime, :)
Works great, if you would like me to further explain or show you by code
examples let me know, it seems to work well.
I used this technique with creating RecognizerContexts on a TabletApp that
worked well there as well, the RecognizerContext obect is a huge hit , :)
Make one, use it everywhere,

Mark

"MajorTom" <m.********@NOverizon.net.do> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Thanks for your help.

As you say that I just be able to share the dataset normally.
I check for the number of rows at the second form, and found they are
there.

the problem was with my control (combobox) that don't display any rows,
datasource and all others necessary proprieties were set, but for a reason
I
don't understand now, I have to set the datasource again at the load event
of the second form.

now is working ok, but when I set de datasource of the combobox

this.cboCodControl.DataSource = this.ds1inv_master1.inv_master;

I get almost the same performance problem (this is what I want to avoid),
the dataset is very big and it take some seconds processing that line of
code (or some one related)

I want to make a example project, but have to deal with a lot of SQL
tables.

Is the another way for me to get the desired results

Tanks very much

MajorTom
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:eE**************@TK2MSFTNGP09.phx.gbl...
MajorTom,

I think that you are doing something wrong if you have no rows. Can

you
show some of the code, or a sample project which shows the problem? You
should just be able to share the data set normally.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"MajorTom" <m.********@NOverizon.net.do> wrote in message
news:ui****************@TK2MSFTNGP15.phx.gbl...
> 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
>
>



Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: TG | last post by:
Conditions: Register globals is set to on. Parse html as php is set to on. I have two forms OrderTest1 and OrderTest2 and need to be able to validate the data from OrderTest1 before passing to...
0
by: Douglas Collie | last post by:
Is there a bug using an untyped memory based data set? I have a form with a tab control, on one tab is a data grid linked to a dataset which I add data to at regular intervals. I have a second...
2
by: bryhhh | last post by:
I have am still learning C#, so please bear with me. I have an application that needs to open a second form, but I need the second form to process message loops, whilst the original form also...
5
by: Benny Raymond | last post by:
I have a program that has a main form and several modeless forms. I'd like to access the same dataset that is loaded when the main form loads from all of the forms - How to do this? In vb.net I...
2
by: John Howard | last post by:
I am invoking a second form and would like to pass a parameter. My code is: Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click Dim...
1
by: Frustrated Developer via DotNetMonster.com | last post by:
I have developed a form that would allow the user to load and search a database several ways, by data range using two combo boxes, by specific number entered in a text box or all database entries....
2
by: slb813 | last post by:
Hello, I am new to PHP and have created a file that will show a HTML page to ank for a record key, then select the kay from a MS Access database and display it on another form in the same PHP...
5
by: huseyin | last post by:
Hello, I have two forms written mainly in php. Here how it functions currently: - First form has two submit buttons. - First submit button is a search button that submits a value of an input...
2
by: John Lewis | last post by:
I have created a windows form application using an Access 2003 db. I used the drag and drop methods to place the fields on the forms and the same with the second form using the related table from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.