Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 11-08-2009
Member
 
Join Date: Oct 2008
Posts: 79
How to insert new line in message box

I have very simple problem, I would like to know how to make a new line when showing a message box but this would be managed through C# and there i decided to develop an application in, where i have decided to display a string in a MessageBox which would be having newlines in it. there i have decided to keep it in the I've got "\r\n" but has v din the string, but when displayed, it shows the characters "\r\n", rather than a newline. Is there any other way through which I can do the same thing. Please help.
Reply With Quote
  #2  
Old 11-08-2009
Member
 
Join Date: Feb 2009
Posts: 117
Re: How to insert new line in message box

If you want to force a new line in a message box, you can include either:

The Visual Basic for Applications Constant for a carriage return and line feed, vbCrLf.
-or-
The character codes for a carriage return and line feed, Chr(13) & Chr(10).

To do this you would write the code for the message box as:

MsgBox ?The record has now been Saved? & vbCrLf & vbCrLf & ?The database will now close?.
Reply With Quote
  #3  
Old 11-08-2009
Member
 
Join Date: Jan 2006
Posts: 6,878
Re: How to insert new line in message box

The two vbCrLf forces two rows in the message box to display the message as:

The record has now been Saved. You may also achieve inserting new line in message box by writing down the following line.

MessageBox.Show("Line one\nLine two");

You can also use this constant in other instances, for example in setting out text to send in e-mail messages via VBA code.
Reply With Quote
  #4  
Old 11-08-2009
Member
 
Join Date: Jan 2009
Posts: 140
Re: How to insert new line in message box

MessageBox(hWnd, TEXT("Line\n"), TEXT("Caption"), MB_OK); \n is not for VB.NET. \n is used in languages that escape characters with \ (\t, \n, \\, \r, \f, etc). or else you may use the MessageBox.Show("plz giv" + System.Environment.NewLine + "c0d!");
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to insert new line in message box"
Thread Thread Starter Forum Replies Last Post
Error message?Insert sim? on Nokia N8 Emilian Portable Devices 4 12-02-2011 07:24 AM
To insert a horizontal line in Word Balamani Windows Software 3 21-10-2009 07:04 PM
Script to insert new line in a file in linux OSzilla Operating Systems 3 28-07-2009 11:48 PM
Insert Border Line in Microsoft Word LikiFerio Windows Software 3 07-07-2009 10:44 PM
How to Insert line break in XML Suzane Software Development 2 07-07-2009 01:00 PM


All times are GMT +5.5. The time now is 07:33 PM.