Re: different forms

From: Branimir Giurov (branimir_at_nospam.com)
Date: 04/22/04


Date: Thu, 22 Apr 2004 10:05:50 +0300

Hi there,

there is more than one way to do what you want -

1. You can declare a static variable of the main form's type at the main
form. So when it initializes, you can set the static variable to the
instance that's being created.
>From there on, you can access the instance from the other forms.

2. You can pass a reference of the form that opens the second/third/etc form
while opening it. Then access the data that's being contained in it.

3. If you pass variables that are being passed by reference (that means
pretty much everything that is a class type of variable (without strings -
they are being copied always, exept when you pass them by ref), you don't
need to worrie about the amount of the data - you're passing just a
reference - that means that you'll copy only 4 bytes (for the address space
that's gonna be allocated on the stack).
If you want to pass vars that are not of a ref type, then use the ref
keyword for the parameter at function's argument list.

Cheers,
Branimir

-- 
Branimir Giurov
MCSD.NET, MCDBA, MCT
eAgility LLC
"Michael" <vocal31@hotmail.com> wrote in message
news:9jJhc.1106$0u6.400672@attbi_s03...
> Hi, I am writting a C# application, not webform
> My application has baseform and 4 other forms,
> my problem is how to pass the value or data of the textbox from 1st form
to
> the label or listbox on the last form
> all of the forms are inherted from the base form.
> I know I can create a global variable but I have a lot of data to pass,
>
> and another question, when I switch to different form, and I use
> this.visible= flase
> how do I write the code so the main page. visible will become true?
>
>


Relevant Pages

  • Re: ref params
    ... The REFERENCE was passed by value. ... my DataTable param var is populated. ... that it was passed by ref, ... in C#, in order to declare a parameter as ref, you need to declare it as ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Passing arguements by reference
    ... but doSomething doesnt change p unless i use "ref"? ... reference, hence both p and q pointing to the same object, not to different ... don't use the ref keyword. ... void Execute() ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Documentation suggestions
    ... > Ian> I think it would be very useful if there was reference (not just ... Lang ref as only for "language lawyers". ...
    (comp.lang.python)
  • Re: pass by reference
    ... focus has moved from insisting to use "by ref" in java-context ... independent of any other use of the word "reference" in a language. ... Just because Java-refs can be re-targetted by assignment? ... If Java had an operator to tell an Object ...
    (comp.lang.java.programmer)
  • Re: Texas TMS1232 Delta Sigma converters
    ... John Larkin writes: ... >>picked up between the transducer and the ADC I'm trying to eliminate. ... the reference problem is serious. ... We're using an Analog Devices Xfet ref, ADR421, ...
    (sci.electronics.design)