TextBox 文本框先吧Multiline属性设置成True,然后再需要更改TextBox显示内容的地方使用如下代码:
Textbox1=Textbox1 & vbcrlf & sAddString ‘Textbox换行后,吧sAddString字符串变量的内容添加到Textbox1的最后一行
'解释:
'Textbox1 是你的文本框空间名称; VBCRLF 是VB的换行回车符 ; sAddString是我随便写的一个字符串变量名。
具体代码手头没有VB,懒得写了,楼主自己琢磨一下就应当能搞出来了,毕竟是学习吗。呵呵
Text1控件的MultyLine属性必须设置为True,然后再使用如下代码:
Private Sub Check1_Click(Index As Integer)
Text1 = ""
For i = 0 To Option1.Count - 1
If Option1(i).Value Then
Text1 = Option1(i).Caption & vbCrLf
End If
Next i
For i = 0 To Check1.Count - 1
If Check1(i).Value Then Text1 = Text1 & Check1(i).Caption & vbCrLf
Next i
End Sub
Private Sub Option1_Click(Index As Integer)
Text1 = ""
For i = 0 To Option1.Count - 1
If Option1(i).Value Then
Text1 = Option1(i).Caption & vbCrLf
End If
Next i
For i = 0 To Check1.Count - 1
If Check1(i).Value Then Text1 = Text1 & Check1(i).Caption & vbCrLf
Next i
End Sub
Private Sub Button1_Click()
Dim str As String
str = ""
If OptionButton1.Value Then
str = str + OptionButton1.Caption + vbCr
End If
If OptionButton2.Value Then
str = str + OptionButton2.Caption + vbCr
End If
If OptionButton3.Value Then
str = str + OptionButton3.Caption + vbCr
End If
If CheckBox1.Value Then
str = str + CheckBox1.Caption + vbCr
End If
If CheckBox2.Value Then
str = str + CheckBox2.Caption + vbCr
End If
TextBox1.Text = str
End Sub