: : : : : : Suppose that Form A has a button that when clicked creates Form B.
: : : : : :
: : : : : : How do you pass information from Form A to Form B?
: : : : : :
: : : : : :
: : : : : What specific data would you want to pass?
: : : : :
: : : : : you could pass all sorts of Data are you looking at passing text, images, ECT?
: : : : :
: : : : :
: : : :
: : : : Assuming you want to pass an integer:
: : : :
: : : : In Form B
: : : :
: : : : #Region " Windows Form Designer generated code "
: : : :
: : : : Public Sub New(ByVal xValue As Integer)
: : : :
: : : : valX = xValue
: : : :
: : : :
: : : : #End Region
: : : :
: : : : 'Before Form Load
: : : : Dim valX As Integer
: : : :
: : : :
: : : : In Form A:
: : : : 'Code behind Button
: : : :
: : : : dim xValue as integer
: : : :
: : : : xValue = 20 'Or any integer value you want to pass
: : : : Dim frm As New frmB(xValue)
: : : :
: : : :
: : : : Hope this helps.
: : : :
: : : :
: : : :
: : : : That helps alot...I wasn't aware of the "New" method. Seems like I should have been since it's basicly a constructor for the form!
: : :
: : : Thanks a bunch!
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : : :
: : :
: : :
: : Or by
: : Dim Shared X as String (in formA)
: :
: : then in formB
: : you could set varible Y - formA.X
: :
: :Does the New() method have to be in the windows generated code region?
: :I'm wondering now, because I tried this method and during runntime, when i called the form without arguments, the form would show as designed, but if I called the form with arguments, a blank form would show. I had the New() method outside of the windows generated code region, now I wonder if this is the reason why.
: :
: :
:
:
:
:
Im not sure if it will make a difference, I have only tried it with the code in the windows generated code.