Click here to Skip to main content
11,408,708 members (63,585 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
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 21:32pm
Edited 19-Sep-11 22:01pm
Thiagarajan Duraisamy at 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 at 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 at 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
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 294
2 Maciej Los 155
3 PIEBALDconsult 140
4 Peter Leow 140
0 Sergey Alexandrovich Kryukov 8,626
1 OriginalGriff 6,855
2 Maciej Los 3,322
3 Abhinav S 3,238
4 Peter Leow 3,034

Advertise | Privacy | Mobile
Web04 | 2.8.150414.5 | Last Updated 20 Sep 2011
Copyright © CodeProject, 1999-2015
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