VB中关于TEXT不CLS问题

来源:百度知道 编辑:UC知道 时间:2024/05/27 11:04:54
我想每次输入的值不进行覆盖..
比如输入一个TEXT
按一下是TEXT..而按第2下我想在次(在第2行)在输一个TEXT请问怎么实现
lyglay - 经理 四级 不行哦!!

把文本框Multiline属性设为True.
一个按钮
private sub command1_click()
dim a$
a=inputbox("Input")
text1=text1 & a & vbcrlf
end sub

改用ComboBox控件

Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = 13) And Len(Combo1.Text) Then Combo1.AddItem Combo1.Text: Combo1.Text = ""
End Sub

输入完内容按回车键,内容就加入到combo1中,且随时方便你提取

明白了,你是想要像命令提示符模式一样吧。只要提取最后一行就行了。

写了个函数:
Public Function GetTextCur(txtText As TextBox)
Dim sTemp() As String

sTemp = Split(txtText.Text, vbCrLf)
GetTextCur = sTemp(UBound(sTemp))

End Function

用时:
(比如有Text1)
Msgbox GetTextCur(Text1)

你要在哪里输入啊?