Declare public variable in C#1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am beginner in using C#, actually I am trying to move from VB6 to C#
I need very small maybe you will laugh when you get it that simply I have 2
forms let’s say Form1 (main form) and Form2 and there is parameter in form2 I
have to call from form1.
So please would you tell me how?


What I tried is like this
//I call public variable lets say SqlReportPar in Form1

Public string SqlReportPar;

//Then go to Form2
Form test=new Form1();
Test. //(the SqlReportPar does not appear) why?????

//What happened!
Form test=new Form1(). //(the SqlReportPar appear here )!!!!!
Test. //(the SqlReportPar does not appear) why?????



Any way thanks
 
The type of test in your code is Form not Form1.

Try:

Form1 test = new Form1();
test.

Christof
 
Back
Top