简体   繁体   English

将文本从一种形式转移到另一种形式

[英]Transferring text from one form to another form

I'm having a hard time transferring the text from the Textbox4 in StudentInfo form to the Textbox in Categories form.我很难将文本从 StudentInfo 表单中的 Textbox4 传输到 Categories 表单中的文本框。 I've done the basic Textbox.Text = Categories.Textbox.Text code (I've reversed it also by coding on Categories_Load event), but still, I can't display the text.我已经完成了基本的 Textbox.Text = Categories.Textbox.Text 代码(我也通过在 Categories_Load 事件上编码来反转它),但仍然无法显示文本。

Can anyone help me here?有人能帮我一下吗?

PS: I've also done the Public Property code. PS:我也做了公共财产代码。 AND by the way, the studentinfo form has still to jump to 2 forms before it reaches the categories form.顺便说一下,studentinfo 表单在到达类别表单之前仍然需要跳转到 2 个表单。

My code in a button in studentinfo (confirm & continue)我在学生信息按钮中的代码(确认并继续)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As     System.EventArgs) Handles Button1.Click
        TextBox4.Text = Categories.yrlvlhere.Text

End Sub

In categories:在类别中:

Private Sub Categories_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.yrlvlhere.Text = StudentInfo.TextBox4.Text
End Sub

yrlvlhere is the name of the textbox I will be changing texts with. yrlvlhere 是我将用来更改文本的文本框的名称。

A visual representation of what I am trying to do:我正在尝试做的事情的直观表示:

在此处输入图片说明

TextBox4.Text = Categories.yrlvlhere.Text

With this you are overwriting the text from TextBox4 in StudentInfo with the then empty text from yrlvlhere in Categories .这样,你就覆盖从文本TextBox4StudentInfo从当时的空文本yrlvlhereCategories
Just switch the sides of the assignment.只需切换作业的两侧即可。

Categories.yrlvlhere.Text = TextBox4.Text

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM