本文介绍了在Windows窗体之间传递数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我想知道如何在两个窗体之间传递文本。我目前正在使用带有.net框架的vb.net 4.我有一个带有2个按钮的主窗体(btnbrowse,btnclose)& 2个文本框(txtName,txttype)。当用户点击btnbrowse我想要form2(对话框)时,显示然后用户可以从组合框中选择项目。当用户点击确定时,我希望它将数据传回txttype上的MAINFORM。 公开 属性 PassType 作为 String 获取 返回 txttype.Text 结束 获取 设置( ByVal value 作为 字符串) txttype .Text = value 结束 设置 结束 物业 私人 Sub Button1_Click( ByVal sender As System。对象, ByVal e As System.EventArgs)句柄 Button1.Click MAINFORM.TXTTYPE.TEXT = PassType Me .Close() 结束 Sub 它仍然不起作用......这有什么问题......因为我迷惑自己...任何帮助都会很棒。 提前谢谢。解决方案 Hi All,I was wondering how can i pass text between two windows forms. i am currently using vb.net with .net framework 4. I have a mainform with 2 buttons (btnbrowse, btnclose) & 2 textboxs(txtName, txttype). When the user clicks btnbrowse i want form2 (dialogbox) do show and then the user able to select item from combobox. when the user clicks ok i want it to pass the data back to MAINFORM on txttype.Public Property PassType As String Get Return txttype.Text End Get Set(ByVal value As String) txttype.Text = value End SetEnd Property Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickMAINFORM.TXTTYPE.TEXT = PassType Me.Close() End Subit still does not work...is there something really wrong with this....cos im confusing my self...any help would be great.thanks in advance. 解决方案 这篇关于在Windows窗体之间传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-22 05:21