在字符串处理时,如果字符串变量必须有引号,怎么处理呢?如
str= [MyName = "MaNongKu" Class = "6"]
很多初学者肯定使用了C/C++的方法,"\"",或者""",这些在Vb中都是错误的。
新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Sub Command1_Click()
Dim str As String
str = "[MyName =" & """" & "MaNongKu" & """" & " Class = " & """" & "6" & """" & "]"
Debug.Print str
End Sub
运行结果就是:
[MyName ="MaNongKu" Class = "6"]