设置一个按钮,在输入text1后单击该按钮,就可以将text1中的空格和回车去掉然后复制到text2中
按钮的代码如下:
Private Sub Command1_Click() Dim i%, s$ s = Text1.Text For i = 1 To Len(s) If Asc(Mid(s, i, 1)) <> 32 And Asc(Mid(s, i, 1)) <> 13 Then Text2.Text = Text2.Text & Mid(s, i, 1) Next
End Sub
试试下面这个
Public Function removing( s as string ) Dim i% For i = 1 To Len(s) If Asc(Mid(s, i, 1)) <> 32 And Asc(Mid(s, i, 1)) <> 13 Then Text2.Text = Text2.Text & Mid(s, i, 1) Next
end