If I understand you correctly, form2 is used to display
the results of a db query whose parameter is selected
from form1. The query logic is in form2 and you can't
pass the variable. Is this correct?
If so, why don't you just pass the variable from form1 to
form2's function before displaying form2 instead of
trying to retrieve the variable from form1?
Form2 f2 = new Form2();
f2.GetSomeData(variableInQuestion);
f2.ShowDialog();
If that doesn't suit your needs, you could add a Caller
property to form2 and set it as 'this' before showing the
form.
Form2 f2 = new Form2();
f2.Caller = this;
f2.ShowDialog();
Then, in form2...
this.GetSomeData(Caller.variableInQuestion);
Most likely, though, I have misinterpreted your question
and was of no help whatsoever.
Charlie
-----Original Message-----
I have two forms. From form one I have a listbox that
when doubleclicked I get the selected value (string) and store in a
variable. Iparse the string to get the first 12 characters and
store it in avariable to query a sql db. I set break points to see
the data as itis passed from form1 and when calling the function from
form2 to getthe variable, its contents are blank.
I believe what I'm looking for is some method to access
an instance aspecific instance and not create a new one that seems to
wipeeverything out.
.