我想在VB中把文本的半角标点全部转成全角,但只执行了一个。请问是哪里出了问题呢?谢谢! 10
控件只有Command1和Text1,程序如下:——————PrivateSubCommand1_Click()Dimmenndai1AsString,menndai2A...
控件只有Command1和Text1,程序如下:
——————
Private Sub Command1_Click()
Dim menndai1 As String,menndai2 As String, touann1 As String, sumoku As Integer
n = 1
menndai1 = ","
menndai2 = "."
On Error Resume Next
n = 1
sumoku = 0
If n < 3 Then
Do
DoEvents
Text1.SetFocus
Text1.SelStart = InStr(intks + 1, Text1.Text, menndai1) - 1
If Err = 380 Then
n = n + 1
Exit Do
End If
intks = Text1.SelStart + Len(menndai1)
Text1.SelLength = Len(menndai1)
Clipboard.Clear
Clipboard.SetText ","
Text1.SelText = Clipboard.GetText
sumoku = sumoku + 1
Loop
ElseIf n = 2 Then
Do
DoEvents
Text1.SetFocus
Text1.SelStart = InStr(intks2 + 1, Text1.Text, menndai2) - 1
If Err = 380 Then
MsgBox "替换完毕", vbOKOnly, "替换完毕"
Exit Do
End If
intks2 = Text1.SelStart + Len(menndai2)
Text1.SelLength = Len(menndai2)
Clipboard.Clear
Clipboard.SetText "。"
Text1.SelText = Clipboard.GetText
sumoku = sumoku + 1
Loop
End If
End Sub 展开
——————
Private Sub Command1_Click()
Dim menndai1 As String,menndai2 As String, touann1 As String, sumoku As Integer
n = 1
menndai1 = ","
menndai2 = "."
On Error Resume Next
n = 1
sumoku = 0
If n < 3 Then
Do
DoEvents
Text1.SetFocus
Text1.SelStart = InStr(intks + 1, Text1.Text, menndai1) - 1
If Err = 380 Then
n = n + 1
Exit Do
End If
intks = Text1.SelStart + Len(menndai1)
Text1.SelLength = Len(menndai1)
Clipboard.Clear
Clipboard.SetText ","
Text1.SelText = Clipboard.GetText
sumoku = sumoku + 1
Loop
ElseIf n = 2 Then
Do
DoEvents
Text1.SetFocus
Text1.SelStart = InStr(intks2 + 1, Text1.Text, menndai2) - 1
If Err = 380 Then
MsgBox "替换完毕", vbOKOnly, "替换完毕"
Exit Do
End If
intks2 = Text1.SelStart + Len(menndai2)
Text1.SelLength = Len(menndai2)
Clipboard.Clear
Clipboard.SetText "。"
Text1.SelText = Clipboard.GetText
sumoku = sumoku + 1
Loop
End If
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询