[SOLVED] vbCrLf symbol to down the line of text with MessageBox

Answered Closed

Hi Wisej,

When i am using vbCrLf symbol to down the line of text, MessageBox lost <CusCode: KH-001>”.

This code:

If MessageBox.Show(“Are you sure to delete it ?” & vbCrLf & “<CusCode: KH-001>”, “App”, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = DialogResult.OK Then
End If

Thank you.

  • You must to post comments
Best Answer

Hi Huỳnh,

This is because your <> tags are getting treated like HTML. If you put a space after the opening and closing symbol like: < CusCode: KH-001 > it will work fine. This is by design to allow the developer to choose how to format the MessageBox contents.

You could also use “<br>” in the MessageBox and it would break to a new line!

Alternatively, if you want to disable the HTML in the MessageBox, set it to false when you show the MessageBox:

MessageBox.Show(“MyMessage”, allowHtml:=False)

This should make your current code work fine.

Let me know if you have any questions about it!



  • You must to post comments
Showing 1 result