Private Sub Text1_KeyPress(KeyAscii As Integer) Dim strAry() As String
If KeyAscii = vbKeyReturn Then strAry = Split(Text1.Text, vbCrLf) If UBound(strAry) > 4 Then KeyAscii = 0 MsgBox "对不起,只允许输入6计" End If End If End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) Dim strAry() As String
If KeyAscii = vbKeyReturn Then strAry = Split(Text1.Text, vbCrLf) If UBound(strAry) > 5 Then KeyAscii = 0 End If End If End SubPrivate Sub Text1_change() Dim strAry() As String
strAry = Split(Text1.Text, vbCrLf) If UBound(strAry) > 5 Then msgbox "不允许超过6行!"' End If End Sub
'将Text1.ScrollBars = 3 - Both 、Text1.MultiLine = True Private Sub Text1_Change() Dim strAry() As String Dim mTempA As String strAry = Split(Text1.Text, vbCrLf) If UBound(strAry) > 5 Then Text1.SelStart = Len(strAry(0) & strAry(1) & strAry(2) & strAry(3) & strAry(4) & strAry(5)) + 10 Text1.SelLength = Len(Text1.Text) - Len(strAry(0) & strAry(1) & strAry(2) & strAry(3) & strAry(4) & strAry(5)) SendKeys "{BackSpace}" End If End Sub
Dim strAry() As String
If KeyAscii = vbKeyReturn Then
strAry = Split(Text1.Text, vbCrLf)
If UBound(strAry) > 4 Then
KeyAscii = 0
MsgBox "对不起,只允许输入6计"
End If
End If
End Sub
Dim strAry() As String
If KeyAscii = vbKeyReturn Then
strAry = Split(Text1.Text, vbCrLf)
If UBound(strAry) > 5 Then
KeyAscii = 0
End If
End If
End SubPrivate Sub Text1_change()
Dim strAry() As String
strAry = Split(Text1.Text, vbCrLf)
If UBound(strAry) > 5 Then
msgbox "不允许超过6行!"'
End If
End Sub
Private Sub Text1_Change()
Dim strAry() As String
Dim mTempA As String
strAry = Split(Text1.Text, vbCrLf)
If UBound(strAry) > 5 Then
Text1.SelStart = Len(strAry(0) & strAry(1) & strAry(2) & strAry(3) & strAry(4) & strAry(5)) + 10
Text1.SelLength = Len(Text1.Text) - Len(strAry(0) & strAry(1) & strAry(2) & strAry(3) & strAry(4) & strAry(5))
SendKeys "{BackSpace}"
End If
End Sub