如何将值从一个文本框复制到另一个文本框来自不同的两个表单vb.net 2008?

时间:2011-01-06 14:08:13

标签: vb.net

我在表单中使用面板,面板包含一个文本框,表单包含另一个文本框。当我单击OK按钮面板,生病隐藏和表单生成时,面板中文本框的值将转移到同一表单中的另一个文本框。请帮助我任何人。

3 个答案:

答案 0 :(得分:2)

在按钮点击事件中只需: -

Text2.Text = Text1.Text

答案 1 :(得分:0)

我不知道我是否理解正确,我做了一个小例子  你好Fabrizio

 <asp:Panel ID="Panel1" runat="server">
       <div>
         <asp:Label ID="Label1" runat="server" Text="Testo 1"></asp:Label>
         &nbsp;
         <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      </div>
    </asp:Panel>


      <div>
         <asp:Label ID="Label2" runat="server" Text="Testo 2"></asp:Label>
         &nbsp;
         <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
      </div>

      <div>
         <asp:Button ID="Button1" runat="server" Text="Button" />
      </div>

 Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim str1 As String = Me.TextBox1.Text
        Me.Panel1.Visible = False
        Me.TextBox2.Text = str1
    End Sub

答案 2 :(得分:0)

Public Shared Function GrabURL(ByRef value As String) As String
    If (value Is Nothing) Then
        Return ""
    Else
        Return Regex.Match(value, "(http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?)").Value
    End If
End Function

' if empty string is added:
FForm2.ListView1.Items.Add(New ListViewItem(GrabURL(RichTextBox1.Text)))

' if empty URL should be ignored:
dim lviURL as New ListViewItem(GrabURL(RichTextBox1.Text))
if lviURL .Text <>"" then FForm2.ListView1.Items.Add(lviURL)