首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

五个TEXTBOX的内容复制,该怎么解决

2011-12-31 
五个TEXTBOX的内容复制分别的TEXTBOX1=A:TEXTBOX2=B:TEXTBOX3=C:TEXTBOX4=D:TEXTBOX5=ETEXTBOX1=B:TEXTBOX

五个TEXTBOX的内容复制
分别的   TEXTBOX1=A:TEXTBOX2=B:TEXTBOX3=C:TEXTBOX4=D:TEXTBOX5=E
              TEXTBOX1=B:TEXTBOX2=C:TEXTBOX3=D:TEXTBOX4=E:TEXTBOX5=“”  
              TEXTBOX1=C:TEXTBOX2=D:TEXTBOX3=E:TEXTBOX4=“”:TEXTBOX5=“”
              TEXTBOX1=D:TEXTBOX2=E:TEXTBOX3=“”:TEXTBOX4=“”:TEXTBOX5=“”
              TEXTBOX1=E:TEXTBOX2=“”:TEXTBOX3=“”:TEXTBOX4=“”:TEXTBOX5=“”

我只会做到三个的交换内容
  Private   Sub   Button2_Click(ByVal   sender   As   System.Object,   ByVal   e   As   System.EventArgs)   Handles   Button2.Click
           
                Dim   them   As   Integer
                them   =   TextBox2.Text

                TextBox2.Text   =   TextBox3.Text

                TextBox1.Text   =   them

请教各位VB高手代码应怎样写:谢谢

[解决办法]
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim midVar1 As String
Dim midVar2 As String

midVar1 = TextBox4.Text.Trim
TextBox4.Text=TextBox5.Text.Trim
midVar2=TextBox3.Text.Trim
TextBox3.Text=midVar1
midVar1=TextBox2.Text.Trim
TextBox2.Text=midVar2
TextBox1.Text=midVar1

End Sub
[解决办法]
Dim TextBox(6) As TextBox
Dim i As Int32
Dim intRow As Int32 = 12
Dim intCol As Int32 = 12
Dim Button1 As Button

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For i = 1 To 5
TextBox(i) = New TextBox
With TextBox(i)
.Left = intCol
.Top = intRow
End With
intRow += 30
Me.Controls.Add(TextBox(i))
Next
Button1 = New Button
With Button1
.Left = 12 + TextBox(1).Width + 12
.Top = 12
.Height = 21
.Text = "移动 "
AddHandler Button1.Click, AddressOf Button1_Click
End With
Me.Controls.Add(Button1)
Me.StartPosition = FormStartPosition.CenterScreen
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
For i = 1 To 5
If i = 5 Then
TextBox(i).Text = " "
Else
TextBox(i).Text = TextBox(i + 1).Text
End If
Next
End Sub
[解决办法]
AA88665599() ( ) 信誉:100 Blog 2007-02-04 23:02:24 得分: 0
我用的是VB。NET,我试过,这方法不行

-------
呵呵~写漏了一句:
textbox1.text = textbox2.text
textbox2.text = textbox3.text
textbox3.text = textbox4.text
textbox4.text = textbox5.text
textbox5.text = " "
本来不想测试的~既然你说不行只好试试~我用VB.NET,测试没有问题。

热点排行