Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net MsgBox不能处理多个字符串_.net_Vb.net - Fatal编程技术网

.net MsgBox不能处理多个字符串

.net MsgBox不能处理多个字符串,.net,vb.net,.net,Vb.net,当我使用此代码时: Dim sessionid = "sessionid = " + """" + TextBox2.Text + """" Dim steamlogin = "steamLogin = " + """" + TextBox3.Text + """" Dim steamparental = "steamparental = " + """" + """" Dim sortextera = "sort = " + """" + """" MsgBox(SettingsDir, se

当我使用此代码时:

Dim sessionid = "sessionid = " + """" + TextBox2.Text + """"
Dim steamlogin = "steamLogin = " + """" + TextBox3.Text + """"
Dim steamparental = "steamparental = " + """" + """"
Dim sortextera = "sort = " + """" + """"
MsgBox(SettingsDir, sessionid + steamlogin + steamparental + sortextera, True)
VisualBasic出现一个错误,表示无法将其转换为字符串。
有什么帮助吗?

MsgBox
要求将a作为第二个参数,而不是字符串。因此,这应该是可行的:

MsgBox(SettingsDir, MsgBoxStyle.Information, sessionid + steamlogin + steamparental + sortextera)
(我也不知道布尔值作为最后一个参数的用途)

我也更喜欢:

  • 使用
    MessageBox.Show
    而不是VB6
    MsgBox
    与.NET兼容
  • 使用
    &
    而不是
    +
    进行字符串连接,因为
    &
    是专门为字符串定义的,而不是
    +
    ,并减少生成意外转换的机会
  • 使用
    String.Format
    格式化字符串:

    Dim message = String.Format("sessionid = ""{0}"" steamLogin = ""{1}"" steamparental = ""{2}"" sort = ""{3}""",
                                TextBox2.Text, TextBox3.Text, "", "")
    

MsgBox
要求将a作为第二个参数,而不是字符串。因此,这应该是可行的:

MsgBox(SettingsDir, MsgBoxStyle.Information, sessionid + steamlogin + steamparental + sortextera)
(我也不知道布尔值作为最后一个参数的用途)

我也更喜欢:

  • 使用
    MessageBox.Show
    而不是VB6
    MsgBox
    与.NET兼容
  • 使用
    &
    而不是
    +
    进行字符串连接,因为
    &
    是专门为字符串定义的,而不是
    +
    ,并减少生成意外转换的机会
  • 使用
    String.Format
    格式化字符串:

    Dim message = String.Format("sessionid = ""{0}"" steamLogin = ""{1}"" steamparental = ""{2}"" sort = ""{3}""",
                                TextBox2.Text, TextBox3.Text, "", "")
    

您是否将
选项STRICT
设置为
打开
关闭
?另外,如果您连接字符串,请在VB.NET中使用
&
,因为
&
是专门为字符串定义的,而不是
+
,这样可以减少生成非预期转换的机会。什么是SettingsDir变量?您是否将
OPTION STRICT
设置为
打开
关闭
?另外,如果您连接字符串,请在VB.NET中使用
&
,因为
&
是专门为字符串定义的,而不是
+
,这样可以减少生成意外转换的机会。SettingsDir变量是什么?谢谢!你修好了:)谢谢!你修好了:)