在form1和amp;之间发送数据form2文本框到datagridview [英] Send data between form1 & form2 textboxes to datagridview
问题描述
大家好,
我有4&表单5都有几个文本框。
在form4上,插入的所有文本框信息都应使用以下代码转到datagridview;
Hi All,
I have form 4 & form 5 both having several textboxes.
On form4, all the textbox information inserted should go to the datagridview using the following code;
Private Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load
table.Columns.Add("Header1", Type.GetType("System.String"))
然后在单个表单上正常单击按钮时,它将执行以下代码,该代码将填充datagridview1 <
Then when clicking a button normally on a single form, it would execute the following code which would populated the datagridview1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
table.Rows.Add(TextBox1.Text)
我的问题是,如果相反按钮显示form5,我有文本框需要填充到单个datagridview我将如何实现这一目标。
我尝试过以下代码但没有运气:
My question is, if instead the button shows form5 and i have textboxes there which need populating to a single datagridview how would i achieve this.
I have tried the following code but no luck:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
table.Rows.Add(Form4.TextBox1.Text)
想法是插入信息form4中的textbox1然后form5上的textbox 1全部填充到单个datagridview。
我尝试过:
The idea is that information inserted into textbox1 from form4 and then textbox 1 on form5 all populates to a single datagridview.
What I have tried:
<pre>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
table.Rows.Add(Form4.TextBox1.Text)
推荐答案
@OriginalGriff撰写了一系列关于如何在表单之间传递信息的技巧。以下是第一个在两种表单之间传输信息的链接,第1部分:家长给孩子 [ ^ ] - 该提示的内容中有其他链接
@OriginalGriff has written a series of Tips on how to pass information between forms. Here is a link to the first one Transferring information between two forms, Part 1: Parent to Child[^] - there are links to the others in the Contents of that Tip
这篇关于在form1和amp;之间发送数据form2文本框到datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!