passing values in VB.net

Joined
Aug 3, 2002
Messages
19
Good day all,

i have a pretty simple question... but i dont know how to get it done in VB.net.. i havent had the time to learn up OOP fully so i cant really figure this out as yet... I have a couple of forms... and im trying to pass somethings from a couple of textboxes in Form 2 to a listbox in Form1... intially it was pretty simple... but with VB.net being restructured can someone shed some light on how this should be done now...

Cheers

~John~
 
One way to accomplish this is as follows:

Form 2:

Public Shared flda as string
flda = txtBox.Text

Form 1:

listBox.items.add(form2.flda)
 
There are several ways to do this, but in the example attached you can find how I do this (I included some comments for you)

Regards

[edit] Removed binaries from attachment [/edit]
 

Attachments

Last edited by a moderator:
its ok if you click a button and then load a form
eg: Dim frm as New Form1
frm.AddText( Text )
frm.Show()

but what if you want to load form1 , click on it to open form2 then on form2 click a button to set some text on form1.
because if you Dim frm as Form1 its null and if you Dim as new it must make another instance of form1 and add the text to that 1 ( which you cant see ):-\
there must be a way to reference both forms to eachother on start up so that you dont need to create new forms.
 
Dynamic Sysop... pretty much figured out what my next problem would be... i cant get it to work...

whats happening here is... i have to load some data from the database... and i have the MainFrm and my SearchFrm... which is where the user types in the ID or the name for that matter...
now when i press search... its supposed to retrieve the data (the procedure is written in the SearchFrm) and then display it in MainFrm...

when i run this... i dont get anything on my MainFrm... its just plain blank...

what do i do now?
 
One way you could do it would be to make a class that handles all of the interaction with the database and then use it to pass the values to the MainFrm. I dont know if thats the BEST way to go about it but, it will work.
 
Back
Top