473,790 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(thi s.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 1533
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.co m

"MajorTom" <m.********@NOv erizon.net.do> wrote in message
news:ui******** ********@TK2MSF TNGP15.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(thi s.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.cboCodCont rol.DataSource = this.ds1inv_mas ter1.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.c om> wrote in
message news:eE******** ******@TK2MSFTN GP09.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.co m

"MajorTom" <m.********@NOv erizon.net.do> wrote in message
news:ui******** ********@TK2MSF TNGP15.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(thi s.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 RecognizerConte xts on a TabletApp that
worked well there as well, the RecognizerConte xt obect is a huge hit , :)
Make one, use it everywhere,

Mark

"MajorTom" <m.********@NOv erizon.net.do> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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.cboCodCont rol.DataSource = this.ds1inv_mas ter1.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.c om> wrote
in
message news:eE******** ******@TK2MSFTN GP09.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.co m

"MajorTom" <m.********@NOv erizon.net.do> wrote in message
news:ui******** ********@TK2MSF TNGP15.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(thi s.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
5103
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 OrderTest2. The first block of code below is the first form. This form calls itself and does perform the validations correctly as I want. However, once the header redirect to OrderTest2.htm is performed after the isset($POST)) evaluates as true...
0
1224
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 top level window opened by the app. The app opens with Form1 showing a tab without the data grid. I open the second Form and everything is ok.
2
5053
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 continues to process message loops. At the moment, my second form contains this code (and more irrelevant code not listed) public class SecondForm : System.Windows.Forms.Form
5
3713
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 just used a module to start up the main form - that module loaded in the dataset - I couldn't figure out how to use the same method in C# ~Benny
2
4591
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 frmAdminHelp As New frmAdminHelp frmAdminHelp.Show() End Sub
1
1858
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. I'm able to use the combo box selection method multiple times with no problem However, when I try to type in a specific drawing number in the txtDrawingNum.text field and click btnLoad I get the same dataset that I previously had from the combo...
2
1326
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 file. This all works great the second form is presented with the information. The problem that I have is the second form is supposed to allow a user time to modify information and click a submit button, then I take the information and update the...
5
2068
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 field that activates a database query and get the result - I control the length of the entered text with Java Script in the input field and activate the query without clicking the search button when a certain length is achieved - second submit...
2
1544
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 main form (all datasets, Bindings and adapters were set automatically for me)...Question: In access I could use String Link Criteria to get a form to filter records on a second form based on the main form... How do I get the second form to only show...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10413
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9021
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.