I might be making this more complicated than I have to.
I have a form in Visual Basic that is adding a row of data to an Access Database.
What will happen (or rather what I would like to happen) is that when the form is created, a row will be added to said database. Once that row is added, I want to have another form open (called NewWindowA) which will pull information on that database that is related to the ID of the row that was created from the first form.
I know that in NewWindowA I need to have the form load the values on Load. But my question is: How do you pass a value to a new window that's invoked by some action?
You can make a constructor of newwindowa that takes the id Like :
Public Sub New(ByVal ID as Integer)
'Do stuff
End Sub
Another Choice you have that you make a global property in newwindowa
Private _ID As Integer
Public Property ID() As Integer
Get
Return _ID
End Get
Set(ByVal value As Integer)
_ID = value
End Set
End Property
When you want to call neweindowa:
Dim n as New NewWindowA
n.ID = 12312
n.Show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With