我想在一個MsgBox中使用\n
包含多條消息。我需要在顯示MsgBox時刪除此字符串。如何在一個MsgBox中包含多條消息
這是我的代碼。
Dim Msg As String = ""
Dim EmployeeFirstName As String
Dim EmployeeLastName As String
EmployeeFirstName = txtFirstName.Text.Trim
EmployeeLastName = txtLastName.Text.Trim
If EmployeeFirstName = "" Then
Msg = "Please enter First Name!"
Msg += "/n"
End If
If EmployeeLastName = "" Then
Msg += "Please enter Last Name!"
Msg += "/n"
End If
If ddlGender.SelectedItem.Value = -1 Then
Msg += "Plrase Select department"
Msg += "/n"
End If
MsgBox(Msg)
請注意,您應該避免在asp.net中使用MsgBox。當您部署應用程序時,您可能會發現這不起作用,因爲MsgBox僅運行服務器端。看看這個,而不是:http://stackoverflow.com/questions/8338630/messagebox-in-asp-net –
你需要刪除什麼字符串?值得注意的是,你在你的問題中提及'\ n',然後發佈包含'/ n'的代碼,但是在VB中,你通常需要使用常量'vbCrLf'。 –