将倒置的逗号(“”)插入到字符串visual basic
中Dim str As String
str = "*.doc" & "," & "*.docx"
我希望文本框显示"*.doc" & "," & "*.docx"
答案 0 :(得分:4)
根据需要编写字符串:
str = "*.doc" & "," & "*.docx"
加倍引号以逃脱它们:
str = ""*.doc"" & "","" & ""*.docx""
然后引用整个字符串:
str = """*.doc"" & "","" & ""*.docx"""
?str
"*.doc" & "," & "*.docx"
答案 1 :(得分:2)
你所要求的并不清楚。如果这样做,结果字符串将为*.doc,*.docx
。如果你想要倒置的逗号(引号),你会做类似的事情:
str = Chr$(34) & "*.doc" & Chr$(34) & "," & Chr$(34) & "*.docx" & Chr$(34)
这会产生类似
的东西"*.doc","*.docx"
这是你在找什么?如果没有,请告诉我们您要完成的工作,我们可以帮助您。
答案 2 :(得分:2)
这对我有用,试试吧。
Dim str As String = """ * .doc"" & "","" & ""*.docx """
TextBox1.Text = str
答案 3 :(得分:0)
我用一个消息框测试了它,它对我来说很好。
Dim str As String = "*.doc" & "," & "*.docx"
textbox1.text = str
答案 4 :(得分:0)
VB6代码:
Dim str As String
str = "*.doc" & "," & "*.docx"
Text1.Text = str
VB.net代码:
Dim str As String
str = "*.doc" & "," & "*.docx"
TextBox1.Text = str
这两项都有效。