Re: Sharing data between forms

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Red Green (red_at_green.com)
Date: 05/01/04


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?
> >
> >
> >
>
>



Relevant Pages

  • Re: update query: still having problems
    ... bring the workstatus field in the grid and, at the criteria line, write: ... UPDATE Department INNER JOIN Sheet1 ON Department.employeeID = ... What I want to do is press a button that will run the query and update the ...
    (microsoft.public.access.queries)
  • Re: Sequence numbering labels
    ... The upper pane of the query design window contains the tables. ... lower pane is the output grid. ... table field to the query output grid' ...that I did not understand, ... and put that count field into the label via label wizard. ...
    (microsoft.public.access.modulesdaovba)
  • Re: VB.NET - How do I return an AutoNumber from an Insert Statement using the DataGridView
    ... > Thanks for that Bart, ... > the values from my Grid to the TableAdapters Insert method. ... >> choose add query, then choose insert query, use a query like below, ... >>> stored in the SQL Database but a VB generated (or disconected dataset ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Using queries in a table adaptor?
    ... using the query wizard I have added several queries ... FROM [Drive Package] ... Not there is no Join here these are just simple Queries on a simple table. ... I am use the flex grid because of some unique features ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: timeline/calendar datagrid
    ... MS Access MVP ... query via code --the query would create a temp table then populate the ... month/year across the top and a grid for each week within each month. ... i'm not interested in the color, etc of the screenshot. ...
    (microsoft.public.access.forms)