Results 1 to 4 of 4

Thread: How to insert new line in message box

  1. #1
    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.

  2. #2
    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”.

  3. #3
    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.

  4. #4
    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!");

Similar Threads

  1. Error message”Insert sim” on Nokia N8
    By Emilian in forum Portable Devices
    Replies: 4
    Last Post: 12-02-2011, 07:24 AM
  2. To insert a horizontal line in Word
    By Balamani in forum Windows Software
    Replies: 3
    Last Post: 21-10-2009, 07:04 PM
  3. Script to insert new line in a file in linux
    By OSzilla in forum Operating Systems
    Replies: 3
    Last Post: 28-07-2009, 11:48 PM
  4. Insert Border Line in Microsoft Word
    By LikiFerio in forum Windows Software
    Replies: 3
    Last Post: 07-07-2009, 10:44 PM
  5. How to Insert line break in XML
    By Suzane in forum Software Development
    Replies: 2
    Last Post: 07-07-2009, 01:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,319,680.49283 seconds with 17 queries