Click here to Skip to main content
Rate this: bad
good
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..
Continue??
 
Please help me with the code..
i have all code from vb.net 2003 but when i apply to vb.net 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
Edited 19-Sep-11 21:01pm
v2
Comments
Thiagarajan Duraisamy at 20-Sep-11 3:07am
   
what was ur error msg?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

i have tried it in VS2010
MessageBox.Show("first line" & vbCrLf & "second line")
  Permalink  
Comments
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
good
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.
  Permalink  
Comments
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)



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