How to retrieve the value from one form to another in vb.net

I have the problem to retreive the string from one form to another. here is my code: What's wrong with this?

Public Class Form3

    Dim unit As String

    Public itmname As String
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim obj1 As New Form4
        itmname = tb1.Text
        MessageBox.Show(itmname)
        obj1.Label1.Text = itmname
        obj1.Show()

    End Sub
End Class
Public Class Form4
 Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With Form3
            MessageBox.Show("item name:" + .itmname)
           Label1.Text = .itmname
        End With
    End Sub
End Class

Answers


You shouldn't have to do any special code in Form4 to set the value. you already set the textbox value from from3's button click event. Setting again is just overwriting it with a blank value from a newly instantiated form. Just clear all the code you have listed in Form4's load event and it should work.


Need Your Help

performance issues with air app on iphone 4

ios performance mobile air

Currently I am working on an Air app for iOS and Android. Air 3.5 is targeted.

Fixed div at the bottom

html footer viewport fixed

I'm learning HTML & CSS, and I'm having an issue.