5
我已經看了這個問題了10次,但每個答案都是太具體的問題。在vb.net中將變量從一種形式傳遞到另一種形式
我有兩個公共類,每個表單一個。
第一種形式有一個文本框和兩個按鈕:
Public Class frmAdd
Public addvar As String
Public Sub UltraButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNote.Click
If txtAdd.Text = String.Empty Then
MsgBox("Please complete the notes textbox!")
Else
addvar = txtAdd.Text
MsgBox(addvar)
Close()
End If
End Sub
Public Sub UltraButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
End Class
在第二種形式我想採取addvar變量,並說
Public Sub saveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click
frmAdd.show()
me.textbox1.text = addvar
我如何得到這個在VB工作。淨?
完美地工作!謝謝! – anm