Computer Science Canada

multiple forms & variables

Author:  iluvchairs112 [ Thu Feb 28, 2008 4:34 pm ]
Post subject:  multiple forms & variables

I am using Visual Basic Express 2005 (if this helps)
I've created a form with a variable, let's call this variable decPrice, which the user inputs.
On the second form in this project, I'd like the variable decPrice to be shown
However when I've tried this, the problem is that the variable decPrice is "undeclared" on the second form. How do I get it to acknowledge the decPrice from form 1?
Or is there any way that I can basically take user inputted data from one form and output it on the second form in the same project??

Thanks in advance! I really need help ASAP!

Author:  OneOffDriveByPoster [ Thu Feb 28, 2008 5:11 pm ]
Post subject:  Re: multiple forms & variables

iluvchairs112 @ Thu Feb 28, 2008 4:34 pm wrote:
I am using Visual Basic Express 2005 (if this helps)
I've created a form with a variable, let's call this variable decPrice, which the user inputs.
On the second form in this project, I'd like the variable decPrice to be shown
However when I've tried this, the problem is that the variable decPrice is "undeclared" on the second form. How do I get it to acknowledge the decPrice from form 1?
Or is there any way that I can basically take user inputted data from one form and output it on the second form in the same project??

Thanks in advance! I really need help ASAP!
Try refering to the other form by its name. Form1.decPrice for example.

Author:  iluvchairs112 [ Fri Feb 29, 2008 8:21 am ]
Post subject:  RE:multiple forms & variables

@ OneOffDriveByPoster - thank you so much!!
I can't believe I didn't think of that myself so thanks a ton!

Author:  Igneous [ Fri Mar 28, 2008 9:10 am ]
Post subject:  Re: multiple forms & variables

hmm i had trouble with this as well and when i tried your method i get an error stating "it is not accesible in this mannor because it is set to private", so as a solution i declared the variable as public and i got another error message. so for the sake of simplicity what am i doing wrong?


: