How to Add Spaces and Lines in Message Box?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hiren Joshi
    New Member
    • Feb 2008
    • 30

    How to Add Spaces and Lines in Message Box?

    Hi,

    I am displaying a message in Message Box but it comes in only 1 line....

    Is there any way i can make 2 or 3 lines wherever i want in Message Box display? I mean to say I need Line Break in Message Box.

    E.g. My Message is supposed to read as follows:

    "You had Enough Attempt of Login,

    You have Tried 3 Unsuccessful Logins,

    System Terminating"

    Please help,

    Hiren
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    try to use this
    [code=vb]
    msgbox "You had Enough Attempt of Login" & chr(13) & "You have Tried 3 Unsuccessful Logins" & chr(13) & "System Terminating"
    [/code]

    Comment

    • Hiren Joshi
      New Member
      • Feb 2008
      • 30

      #3
      You are Great Debasis,

      It works... What is chr(13) for? is it for Line Break or Next Line?

      Thanks Buddy

      Hiren

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        It is better to use vbNewLine in place of chr(13).

        Comment

        • werks
          New Member
          • Dec 2007
          • 218

          #5
          Hi Hiren try this another Alternative:

          Code:
          MsgBox "You had Enough Attempt of Login," + vbCrlf + "You have Tried 3 Unsuccessful Logins," + vbCrlf + "System Terminating"
          --
          Kenneth
          "Better Than Yesterday"

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            13 is the keycode of ENTER KEY.

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              and vbCrlf is VisualBasicCarr riageReturnLine Feed.

              Comment

              • Hiren Joshi
                New Member
                • Feb 2008
                • 30

                #8
                Yes Thats Cool as well...

                Thanks

                Comment

                • Hiren Joshi
                  New Member
                  • Feb 2008
                  • 30

                  #9
                  Thanks Debasis, Thanks Werks...

                  It was helful information for me... I might post couple of posts tomorrow ...

                  Thanks 2 Both of you once again......

                  Hiren

                  Comment

                  • werks
                    New Member
                    • Dec 2007
                    • 218

                    #10
                    We are happy to help you

                    --
                    Kenneth
                    "Better Than Yesterday"

                    Comment

                    • Killer42
                      Recognized Expert Expert
                      • Oct 2006
                      • 8429

                      #11
                      I recommend using vbNewLine, simply because its purpose is so much more obvious. It has the exact same value as vbCRLF.

                      Comment

                      • Hiren Joshi
                        New Member
                        • Feb 2008
                        • 30

                        #12
                        Any Advance Function for Message Box? Like Changing the Font, Size and Colour? or Aligning the Font in Center?

                        Comment

                        • debasisdas
                          Recognized Expert Expert
                          • Dec 2006
                          • 8119

                          #13
                          Originally posted by Hiren Joshi
                          Any Advance Function for Message Box? Like Changing the Font, Size and Colour? or Aligning the Font in Center?
                          All those are not supported . You can design your own component for that or can use any third party tool.

                          Comment

                          • QVeen72
                            Recognized Expert Top Contributor
                            • Oct 2006
                            • 1445

                            #14
                            Hi,

                            You can Create a Custom Message Box of ur own. Add A new Form and Show it Modally, Add any number of buttons/ Place a Label Control to display the message, and Play with other Visual Properties like Fore Colour/ Back Color/ Font/ ICon/ Background Picture...

                            frmMsg.Show 1

                            Declare a Form Level Public Variable in (frmMsg) , and In ButtonClick, Populate the Variable with Appropriate Values, And check the Value of this Variable in Calling Form..


                            REgards
                            Veena

                            Comment

                            • Hiren Joshi
                              New Member
                              • Feb 2008
                              • 30

                              #15
                              Thanks Once Again Debasis,

                              Any Hint on Creating Own Component?

                              Comment

                              Working...