469,923 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

How to Add Spaces and Lines in Message Box?

Hiren Joshi
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
Feb 13 '08 #1
22 30128
debasisdas
8,127 Expert 4TB
try to use this
Expand|Select|Wrap|Line Numbers
  1. msgbox "You had Enough Attempt of Login" & chr(13) & "You have Tried 3 Unsuccessful Logins" & chr(13) & "System Terminating"
  2.  
Feb 13 '08 #2
You are Great Debasis,

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

Thanks Buddy

Hiren
Feb 13 '08 #3
debasisdas
8,127 Expert 4TB
It is better to use vbNewLine in place of chr(13).
Feb 13 '08 #4
werks
220 100+
Hi Hiren try this another Alternative:

Expand|Select|Wrap|Line Numbers
  1. MsgBox "You had Enough Attempt of Login," + vbCrlf + "You have Tried 3 Unsuccessful Logins," + vbCrlf + "System Terminating"
  2.  
--
Kenneth
"Better Than Yesterday"
Feb 13 '08 #5
debasisdas
8,127 Expert 4TB
13 is the keycode of ENTER KEY.
Feb 13 '08 #6
debasisdas
8,127 Expert 4TB
and vbCrlf is VisualBasicCarrriageReturnLineFeed.
Feb 13 '08 #7
Yes Thats Cool as well...

Thanks
Feb 13 '08 #8
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
Feb 13 '08 #9
werks
220 100+
We are happy to help you

--
Kenneth
"Better Than Yesterday"
Feb 13 '08 #10
Killer42
8,435 Expert 8TB
I recommend using vbNewLine, simply because its purpose is so much more obvious. It has the exact same value as vbCRLF.
Feb 14 '08 #11
Any Advance Function for Message Box? Like Changing the Font, Size and Colour? or Aligning the Font in Center?
Feb 14 '08 #12
debasisdas
8,127 Expert 4TB
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.
Feb 14 '08 #13
QVeen72
1,445 Expert 1GB
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
Feb 14 '08 #14
Thanks Once Again Debasis,

Any Hint on Creating Own Component?
Feb 14 '08 #15
debasisdas
8,127 Expert 4TB
You can design your own usercontrol or refer to the previous post by Qveen72 for an easier solution.
Feb 14 '08 #16
Ok I got the Idea,

Thanks Debasis, Veena

I cant see my other post of Auto Generating the Custom No. While Saving Record? I have posted with the codes I have used. Does it normally take long to Appear in the Forum?

Hiren
Feb 14 '08 #17
debasisdas
8,127 Expert 4TB
Ok I got the Idea,

Thanks Debasis, Veena

I cant see my other post of Auto Generating the Custom No. While Saving Record? I have posted with the codes I have used. Does it normally take long to Appear in the Forum?

Hiren
No it is displayed instantly .

The thread is here.
Feb 14 '08 #18
Killer42
8,435 Expert 8TB
No it is displayed instantly .

The thread is here.
That link doesn't work.
Feb 14 '08 #19
whassup guys i dn knw how to do line space in msgbox
which is
Dim year
Dim loan
Dim rate = 0.037
Dim install


loan = CDbl(txtb1.Text)
year = CDbl(txtb2.Text)

install = ((loan + (loan * rate)) / (year * 12))

MsgBox("Loan :" & loan, "year :" & year, "installment :" &install.msgbox = FormatCurrency(install, 2))


got error but whwn a time do nt have any error
can you guys help me to do this programming ?
Dec 5 '11 #20
acctually the error is

A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Dec 5 '11 #21
Killer42
8,435 Expert 8TB
Sorry for the delay.

I think you'll get a better response to this question in the Visual Basic .NET forum. This one is for the older pre-dotnet versions of VB.
Dec 13 '11 #22
Cjpa
1
Expand|Select|Wrap|Line Numbers
  1. Msgbox("You had Enough Attempt of Login" & vbCrLf & "You have Tried 3 Unsuccessful Logins" & vbCrLf & "System Terminating")
Feb 13 '16 #23

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by qwweeeit | last post: by
17 posts views Thread by bearophileHUGS | last post: by
6 posts views Thread by eight02645999 | last post: by
135 posts views Thread by Xah Lee | last post: by
19 posts views Thread by =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post: by
4 posts views Thread by koutoo | last post: by
1 post views Thread by =?Utf-8?B?S2hhcnRvdW0=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.