Help with value passing

  • Thread starter Thread starter yo_mismo
  • Start date Start date
Y

yo_mismo

Hi,

I send a parameter from a Form (Form1) to an other form (Form2):

Form2 frm2 = new Form2();
frm2.number_frm2 = number_frm1;
frm2.Show();

The problem i got is that the variable 'number_frm2' always have the value 0
(it's an integer). I have declared it as 'public' but i can't get the right
value. I hope someone can help me, thanks.
 
can you post the code for Form2 and Form1, sounds like a casting
problem, you may have to cast number_frm1 to an integer:

frm2.number_frm2 = (int)number_frm1;

if you are passing int to int it should work properly, might be a
better idea to setup a Property in Form2 that sets number_frm2 for you,
instead of setting it directly.
 
yo_mismo said:
I send a parameter from a Form (Form1) to an other form (Form2):

Please read the answers to your identical question from September 20th.
 
Back
Top