MsgBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Parul Bagadia
    New Member
    • Mar 2008
    • 188

    MsgBox

    Hi ppl,
    Does somebody know how do we change the font of message we want to display in message box?
    And how do we write sth on next line in the same message box without natural termination of line?
    in simple words how do we implemnet '\n' in case of message box?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you can't change the font or any other setting of messagebox.

    to write in multiple line you can add CHR(13) or VBCRLF (VISUAL BASIC CARRIAGE RETURN LINE FEED)

    Code:
    MSGBOX " THIS IS FIRST LINE " & VBCRLF & " THIS IS SECONDLINE "

    Comment

    • Parul Bagadia
      New Member
      • Mar 2008
      • 188

      #3
      Originally posted by debasisdas
      you can't change the font or any other setting of messagebox.

      to write in multiple line you can add CHR(13) or VBCRLF (VISUAL BASIC CARRIAGE RETURN LINE FEED)

      Code:
      MSGBOX " THIS IS FIRST LINE " & VBCRLF & " THIS IS SECONDLINE "
      Thanx.
      Can u explain a bit more about CHR(13)?

      Comment

      • jg007
        Contributor
        • Mar 2008
        • 283

        #4
        see here -



        Chr just represents characters and the code 13 is for CR or Carriage Return which I believe is a link to the idea of carridge return on a type writer etc

        as quoted -

        "When you type on a typewriter (for those of you under 25(?) who've never seen one) and reach the end of a line you grasp the "carriage return bar" which would return the carriage to the home position while simultaneously rotating the platen to feed the paper."

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          Originally posted by Parul Bagadia
          Can u explain a bit more about CHR(13)?
          Simply i can say CHR(13) is the Enter key on your key board. As enter key carries the cursor to the next line so is CHR(13).

          Also try to use vbNewLine

          Comment

          • Parul Bagadia
            New Member
            • Mar 2008
            • 188

            #6
            Hello people, thanx a lot for ur suggestions but i guess i didnt get the syntax coz i tried all the things u all suggested but its showing syntactical error :-(..
            ill post the code here and tell me wats going wrong.

            Code:
            Private Sub Command4_Click()                                          'Command box for help purpose
            Dim c As Integer
            c = MsgBox("Steps to run this Program: Step 1:Enter the number on which you want to perfom operations  Step 2:Select one of the choices from the Base of input  Step3: Click on the conversion button for obtaining answer  Step4:To exit from the program click on Quit button.", vbOKOnly, "Help to run this program")
            End Sub
            i want each steps to come in succeeding lines.

            Comment

            • xinariscy
              New Member
              • Sep 2008
              • 14

              #7
              You have no syntactical errors. To implement the '\n' use this:

              Code:
              c = MsgBox("Steps to run this Program:" & vbCrLf & "Step 1:Enter the number on which you want to perfom operations" & vbCrLf & "Step 2:Select one of the choices from the Base of input" & vbCrLf & "Step3: Click on the conversion button for obtaining answer " & vbCrLf & "Step4:To exit from the program click on Quit button.", vbOKOnly, "Help to run this program")
              CHR(13)= 13 is also the ascii code for Enter key.

              Comment

              • Parul Bagadia
                New Member
                • Mar 2008
                • 188

                #8
                Originally posted by xinariscy
                You have no syntactical errors. To implement the '\n' use this:

                Code:
                c = MsgBox("Steps to run this Program:" & vbCrLf & "Step 1:Enter the number on which you want to perfom operations" & vbCrLf & "Step 2:Select one of the choices from the Base of input" & vbCrLf & "Step3: Click on the conversion button for obtaining answer " & vbCrLf & "Step4:To exit from the program click on Quit button.", vbOKOnly, "Help to run this program")
                CHR(13)= 13 is also the ascii code for Enter key.
                That's what i said in my earlier post; its giving compilation error i tried & vbCrLf &
                chr(13) and vbnewline as well... but its not working,....

                Comment

                • xinariscy
                  New Member
                  • Sep 2008
                  • 14

                  #9
                  That's strange.. I just copy-paste your code and works fine.

                  I insert the vbCrLf into your msg box because i thought there was the problem..

                  Comment

                  Working...