Re: Sharing data between forms
From: Red Green (red_at_green.com)
Date: 05/01/04
- Next message: Jim Hughes: "Re: SqlException: EXECUTE permission denied on object"
- Previous message: Jon Skeet [C# MVP]: "Re: SqlException: EXECUTE permission denied on object"
- In reply to: William Ryan eMVP: "Re: Sharing data between forms"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 1 May 2004 11:51:16 -0400
OK I understand how to make a variable public and I have tested it.
The part I don't understand is how to get the value I need to set it to. If
the datagrid has the 3 rd row highlighted that corresponds to a record in
the dataset and a field in that record has the value that I need to get for
the parameter of the dependent query. In Delphi the current record in the
dataset bound to the grid is the one selected in the grid. Is this the case
in C# and if so how do I get that value?
In Delphi it would be
ThisVar := DM1.Qry1FieldName.Value;
DM1.Qry2.Parameters[1].Value := ThisVar;
Where DM1 is the name of the datamodule, Qry1 is the Ado query that is bound
to the datagrid and FieldName is the name of the Data Field with the value
required.
"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:%23dp7g$sLEHA.3052@TK2MSFTNGP12.phx.gbl...
> Set a property or properties in each form and make them public. Set the
> public property and then you can access it from any form.
>
> Or , create a class with static properties...then set the property
> corresponding tot he data you'll need. If you set them as public static,
> they'll be visible by every object in the project.
> "Red Green" <red@green.com> wrote in message
> news:uo16lnsLEHA.3380@TK2MSFTNGP11.phx.gbl...
> > I am trying to switch to C# from Delphi and I am having some trouble
> finding
> > some information. What I need to do should be simple but I have been
> through
> > a dozen books and done web searches that don't help me out at all.
Delphi
> > had a data module that was shared between an applications forms but I
> don't
> > see any way to do this in C#.
> >
> > Lets say I have two forms, the first with a data grid and the second
with
> > field that should contain the data coresponding to the selected record
in
> > the grid. The second form requires setting the query parameter before
> > showing the data. Because of the way that C# seems to work (each form
has
> > it's own connection and data components) I don't understand how to get
the
> > two forms or data sets to communicate with each other.
> >
> > This seems like it should be a very common thing to do, is there an
> example
> > anywhere showing how to do this?
> >
> >
> >
>
>
- Next message: Jim Hughes: "Re: SqlException: EXECUTE permission denied on object"
- Previous message: Jon Skeet [C# MVP]: "Re: SqlException: EXECUTE permission denied on object"
- In reply to: William Ryan eMVP: "Re: Sharing data between forms"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|