限定每行最大长度为45个文字。超过就自动换行及回车。文本框里可能是手工输入也有可能是粘贴。
帮帮忙啊!!最好能给段源码谢谢了。
帮帮忙啊!!最好能给段源码谢谢了。
解决方案 »
- vb里面如何判断系统当前是否可以访问internet资源?
- 新手 跪求此题代码
- 有关LISTVIEW的几个问题
- 请教一个在数据库中新增数据的问题
- *******关于数据录入的讨论******在线等候,答者有分*********
- 文本框如果过大,如何让输入的文字居中,上下左右都居中的那种
- 高手来帮我看下这段代码行不?
- Run-time error 430:class does not support automation or does not suport excepted interface
- 救命呀!!!我的 VB用不了了 !!!我把分数全给你!!!
- 谁有HelpBuilder1.0 sc的注册码,分数不成问题!!!!!!!
- VB打包
- 在线急等:对象未注册问题
Dim a() As String
Dim i As Long
Dim bLineBroken As Boolean
a = Split(Text1.Text, vbCrLf)
For i = 0 To UBound(a)
If Len(a(i)) > 45 Then
a(i) = BreakLine(a(i))
bLineBroken = True
End If
Next
If bLineBroken Then
Text1.Text = Join(a, vbCrLf)
End If
End Sub
BreakLine 自己完成
Private Sub Text1_Change()
Dim a() As String
Dim i As Long
Dim bLineBroken As Boolean
a = Split(Text1.Text, vbCrLf)
For i = 0 To UBound(a)
If Len(a(i)) > 45 Then
a(i) = BreakLine(a(i))
bLineBroken = True
End If
Next
If bLineBroken Then
Text1.Text = Join(a, vbCrLf)
End If
Text1.SelStart = Len(Text1.Text)
End Sub
Private Function BreakLine(strT As String)
BreakLine = Left(strT, 45) & vbCrLf & Mid(strT, 46)
End Function