请教高手,用代码如何实现。
请教高手,用代码如何实现。谢谢有二个文本框,text1和text2,一个按钮 b1
在text1输入:
123
456
789
然后按钮后后,在text2呈现(注意:最后行是没有逗号的):
'123',
'456',
'789' --------------------编程问答--------------------
Private Sub Command1_Click()--------------------编程问答-------------------- 菜鸟跟着学知识。。。。。 --------------------编程问答--------------------
Dim s() As String
Dim ss As String
Dim i As Long
s = Split(Trim(Text1), vbCrLf)
ss = "'" & s(0) & "'"
For i = 1 To UBound(s)
ss = ss & "," & vbCrLf & "'" & s(i) & "'"
Next
Text2 = ss
End Sub
--------------------编程问答-------------------- 用JOIN就可以了。 --------------------编程问答-------------------- 谢谢各位达人,我再研究一下
Private Sub Command1_Click()
Dim Ary() As String
Dim vI As Long
Ary = Split(Trim(Text1.Text), vbCrLf)
For vI = 0 To UBound(Ary)
Ary(vI)="'" & Ary(vI) & "'"
Next
Text2.Text = Join(Ary,"," & vbCrlf)
End Sub
补充:VB , 基础类