Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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..
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:-
VB
Dim answer as string

answer=Messagebox.Show("This will make you exit from system.." & vbCrlf & "Continue??","Exiting system", MessageBoxButtons.YesNo, MessageBoxIcon. Question)
Posted
Updated 19-Sep-11 21:01pm
v2
Comments
Thiagarajan Duraisamy 20-Sep-11 3:07am    
what was ur error msg?

i have tried it in VS2010
VB
MessageBox.Show("first line" & vbCrLf & "second line")
 
Share this answer
 
Comments
Luiey Ichigo 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
In the string, just use \r\n for add a blank row between the two lines.
Alternatively, just use \n for the next line.

VB.NET
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.
 
Share this answer
 
Comments
Luiey Ichigo 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900