How to pass value from one form to another?

songoku107723

Member
Joined
Apr 18, 2008
Messages
12
Programming Experience
Beginner
hello guys.... i'm ricky and i'm newbie in vb .net...

i want ask how to pass value from one form into another form...???

for example if i have 1 mdiform and 2 form (form1, and form2)

for load form1 i'm using system.reflection.assembly

here is the code for load form1 :

Imports System.Reflection

Private Asm As Assembly
Private FrmNama As Form

Public Function GetForm(ByVal FormName As String) As Form

Try

FrmNama = New Form()
Asm = Assembly.GetExecutingAssembly
FrmNama = CType(asm.CreateInstance(asm.GetName.Name & "." & FormName, True), Windows.Forms.Form)

Asm = Nothing

Return FrmNama

Catch ex As Exception

Throw New Exception("GetForm Function Error : " & vbCrLf & ex.Message.ToString)

End Try

End Function

in mdiform i just call the function

here is the code in mdiform :

F_Nama = New Form()
F_Nama = GetForm(CStr(strName).Trim)
F_Nama.MdiParent = Me
F_Nama.Show()

after form1 load i call form2 from form1 and from form2 i want pass value, here is the code from form2 to pass value into form1 :

form1.textbox1.text = textform2.text

why value from form2 can't fill into textbox1 in form1??

please help me... thank's before... :) and sorry if my english langguage bad... :D
 
Last edited:
wokey compguru910 thanks a lot... i will send my email... :p

but about the problem... i got this problem if load the form1 dynamically... and if i loaded form1 not dynamically i can get the value on form2.... T_T i'm verry - verry confuse...

thanks... :D
 
Back
Top