 |
BOOK: Beginning Microsoft Visual Basic 2010
 | This is the forum to discuss the Wrox book Beginning Visual Basic 2010 by Thearon Willis, Bryan Newsome; ISBN: 9780470502228 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning Microsoft Visual Basic 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

May 16th, 2010, 03:24 AM
|
|
Authorized User
|
|
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Display the Length of the String
Hi,
I am New to Visual Basic 2010 So i want to understand why we write
"characters(s)","Strings" al the last of the line
Thanks
MessageBox.Show(strResults.Length.ToString & " characters(s)","Strings")
|
|

May 16th, 2010, 04:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
And which part of it do you not understand?? Can you elaborate a little?
Imar
|
|

May 16th, 2010, 04:33 AM
|
|
Authorized User
|
|
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Imar
And which part of it do you not understand?? Can you elaborate a little?
Imar
|
MessageBox.Show(strResults.Length.ToString & " characters(s)","Strings")
Can u explain simply this line what does it means
thanks
|
|

May 16th, 2010, 05:40 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Did you try it out? It displays a message box that shows the length of strResults in characters. E.g., if strResults contained "Imar" it would show "4 character(s)".
BTW: no need to quote the entire message when replying.
Imar
|
|

May 16th, 2010, 06:19 AM
|
|
Authorized User
|
|
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Imar
Did you try it out? It displays a message box that shows the length of strResults in characters. E.g., if strResults contained "Imar" it would show "4 character(s)".
BTW: no need to quote the entire message when replying.
Imar
|
"Strings")
At the last of the line why we are using "Strings" because it is not displayed.
thanks
|
|

May 16th, 2010, 06:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That's what I meant with " which part of it do you not understand". The clearer your question is, the better the answer.
Take a look at the intelliSense list in Visual Studio for the second parameter. It'll say its the Caption which is used as the title of the Message Box that pops up.
Second attempt: if you reply, can you please not quote the entire previous message?
Imar
|
|

May 16th, 2010, 10:13 AM
|
|
Authorized User
|
|
Join Date: May 2010
Posts: 70
Thanks: 4
Thanked 6 Times in 6 Posts
|
|
kulfi, I too am new to vb2010. I used vb6 for years. LOve it Miss it but see the need to mover on. not sure but I think you might be looking a t the wrong command. the msgBox.show() command displays information about the msgBOx Command. if you are trying to simply display a msgBox on an application try using msgbox command like this...
msgBOx ("This IS What I wanted to display in the first place")
or the msgbox can return a value to you like...
ires = msgBox("do you want to continue?",vbYesNoCancel,vbDefaultButton2,"Title")
hope this helps
|
|

May 16th, 2010, 01:14 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
While MsgBox certainly works, I would focus on MessageBox.Show instead, especially if you have no background in versions of VB prior to .NET. MsgBox was ported over to the .NET framework VB compatibility layer to make the transition from VB 6 to .NET easier, but IMO, MessageBox.Show is closer to how everything else in the .NET Framework works and thus easier to understand and use in the long run.
Cheers,
Imar
|
|

May 16th, 2010, 01:57 PM
|
|
Authorized User
|
|
Join Date: May 2010
Posts: 70
Thanks: 4
Thanked 6 Times in 6 Posts
|
|
OK I hadn't realized that yet. Thanks For the tip.
|
|

May 17th, 2010, 01:12 AM
|
|
Authorized User
|
|
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by GeneBuchite
OK I hadn't realized that yet. Thanks For the tip.
|
Thanks for the so long discussion because non of u understand my question anyhow i will try understand my self.
thanks
|
|
 |
|