Click here to Skip to main content
13,147,183 members (29,431 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi all,

Let say I want to display multiline text in messagebox, could some help me? Below is example of the messagebox text display:-

This will make you exit from system..

Please help me with the code..
i have all code from 2003 but when i apply to 2010, it error with bluestring..Here are sample from my 2003 code:-
Dim answer as string
answer=Messagebox.Show("This will make you exit from system.." & vbCrlf & "Continue??","Exiting system", MessageBoxButtons.YesNo, MessageBoxIcon. Question)
Posted 19-Sep-11 20:32pm
Updated 19-Sep-11 21:01pm
Thiagarajan Duraisamy 20-Sep-11 3:07am
what was ur error msg?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

i have tried it in VS2010
MessageBox.Show("first line" & vbCrLf & "second line")
Fadhli Azmin 20-Sep-11 4:13am
Dear Prasad. Tenkiu a lot.. Your method is working. Now I know. It must not put anything behind the second line syntax such as messageboxbuton or messageboxicon..if not, the underline blue string will appear..Tq prasad
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In the string, just use \r\n for add a blank row between the two lines.
Alternatively, just use \n for the next line.

Dim answer as DialogResult
answer = MessageBox.Show("This will make you exit from system.. \r\nContinue??","Exiting system", MessageBoxButtons.YesNo, MessageBoxIcon. Question)
if (answer == DialogResult.Yes) then
 'Do something
end if

I am a c# developer by default, so appologies if this doesn't work in this syntax, but this should point you in the right direction.
Fadhli Azmin 20-Sep-11 4:12am
Dear Kelvin,
I've tried it. But it doesn't work. I get it now. But I already try the Prasad method. It work.. Anyway, Tq Kelvin for helping

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 20 Sep 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100