在两个表单之间传递变量 [英] Passing variable between 2 forms

查看:53
本文介绍了在两个表单之间传递变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题。

我有两种形式,我想在form1上输入变量并在form2中显示它们

这就是我所拥有的东西

form1

=====

Private Sub Button1_Click(val blala)

Fnamesender = TextBox2.Text

Me.Hide()

Form2.Show()


结束子


form2

== ===

Private Sub Form2_Load(ByVal blabla bla)


Label.text = Fnamesender

end sub


i有一个mudule

===========

模块一

公共Fnamesender作为字符串


结束模块


问题是我在form1中的TextBox2中输入文本并在Label中查看它好的,但是如果你回到form1并在textBox2中输入一个名字,它就不会改变标签。我怎样才能清除标签

I have problem .
Ihave 2 forms , iwant to enter variables on form1 and show them in form2
This what i have soo far
form1
=====
Private Sub Button1_Click(val blala)
Fnamesender = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub

form2
=====
Private Sub Form2_Load(ByVal blabla bla)

Label.text = Fnamesender
end sub

i have a mudule
===========
Module one
Public Fnamesender As String

end module


The Problem is when i enter a text in TextBox2 in form1 and view it in Label its ok , but if you go back to form1 and enter a name in textBox2 it doesnt change in label . how can i clear label

推荐答案


我有问题。

我有两种形式,我想在form1上输入变量并在form2中显示它们

这就是我所拥有的东西

form1

=====

Private Sub Button1_Click(val blala)

Fnamesender = TextBox2.Text

Me.Hide()

Form2.Show()


结束子


form2

== ===

Private Sub Form2_Load(ByVal blabla bla)


Label.text = Fnamesender

end sub


i有一个mudule

===========

模块一

公共Fnamesender作为字符串


结束模块


问题是我在form1中的TextBox2中输入文本并在Label中查看它好的,但是如果你回到form1并在textBox2中输入一个名字,它就不会改变标签。如何清除标签
I have problem .
Ihave 2 forms , iwant to enter variables on form1 and show them in form2
This what i have soo far
form1
=====
Private Sub Button1_Click(val blala)
Fnamesender = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub

form2
=====
Private Sub Form2_Load(ByVal blabla bla)

Label.text = Fnamesender
end sub

i have a mudule
===========
Module one
Public Fnamesender As String

end module


The Problem is when i enter a text in TextBox2 in form1 and view it in Label its ok , but if you go back to form1 and enter a name in textBox2 it doesnt change in label . how can i clear label



你永远不会解释你的问题,你也可以这样使用



Form1

==========

[CODE = vb]

Private Sub Button1_Click(val blala)

Form2.Label.text = TextBox2.Text

Me.Hide()

Form2.Show()


End Sub [/ code]


you never explain what is your problem and you can also use like this


Form1
==========
[CODE = vb]
Private Sub Button1_Click(val blala)
Form2.Label.text = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub[/code]


Form1

==========

[CODE = vb]

Private Sub Button1_Click(val blala)

Form2.Label.text = TextBox2.Text

Me.Hide()

Form2.Show()


结束子[/ code]


即使使用你后我仍然遇到同样的问题代码

这是我的问题

我有两个表单form1和form2

我想将变量TextBox2.Text传递给form2中的Label.text做完之后

i想回到form1并准备好再次进行处理


问题

说我进入了MIKE在Form2.Label.text中的TextBox2.Text中,我得到了MIKE,这很好。但如果我回到form1并在TextBox2.Text中输入JOHN

i仍然在Form2.Label.text中获取MIKE,有没有办法清除Form2.Label.text

在收到我已经尝试过的所有下一个变量之前,Form2.Label.text =""和clear()

i仍然无法使其工作。感谢您的时间
Form1
==========
[CODE = vb]
Private Sub Button1_Click(val blala)
Form2.Label.text = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub[/code]

I still have the same problem even after using your code
Here is my problem
I have two forms form1 and form2
I want to pass variable TextBox2.Text to Label.text in form2 after doing this
i want to go back to form1 and ready to do the proccess again

Problem
Say i entered MIKE in TextBox2.Text in Form2.Label.text i get MIKE , thats good. but if i go back to form1 and enter JOHN in TextBox2.Text
i still get MIKE in Form2.Label.text , Is there a way to clear Form2.Label.text
before reciving the next variable i have tried all , Form2.Label.text="", and clear()
i still cant get it to work . Thanks for your time



Form1

==========

[CODE = vb]

Private Sub Button1_Click(val blala)

Form2.Label.text = TextBox2.Text

Me 。隐藏()

Form2.Show()


结束子[/ code]


我还有使用你的代码后同样的问题

这是我的问题

我有两个表单form1和form2

我想传递变量TextBox2。执行此操作后,在form2中将Label.text文本转换为

i想要返回到form1并准备再次进行处理


问题

假设我在Form2.Label.text的TextBox2.Text中输入了MIKE我得到了MIKE,这很好。但如果我回到form1并在TextBox2.Text中输入JOHN

i仍然在Form2.Label.text中获取MIKE,有没有办法清除Form2.Label.text

在收到我已经尝试过的所有下一个变量之前,Form2.Label.text =""和clear()

i仍然无法使其工作。感谢您的时间
Form1
==========
[CODE = vb]
Private Sub Button1_Click(val blala)
Form2.Label.text = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub[/code]

I still have the same problem even after using your code
Here is my problem
I have two forms form1 and form2
I want to pass variable TextBox2.Text to Label.text in form2 after doing this
i want to go back to form1 and ready to do the proccess again

Problem
Say i entered MIKE in TextBox2.Text in Form2.Label.text i get MIKE , thats good. but if i go back to form1 and enter JOHN in TextBox2.Text
i still get MIKE in Form2.Label.text , Is there a way to clear Form2.Label.text
before reciving the next variable i have tried all , Form2.Label.text="", and clear()
i still cant get it to work . Thanks for your time



您是否点击了命令按钮?


did you click the command button?


这篇关于在两个表单之间传递变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆