Wrox Programmer Forums
|
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
 
Old May 16th, 2010, 03:24 AM
Authorized User
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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")
 
Old May 16th, 2010, 04:29 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

And which part of it do you not understand?? Can you elaborate a little?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 16th, 2010, 04:33 AM
Authorized User
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
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
 
Old May 16th, 2010, 05:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 16th, 2010, 06:19 AM
Authorized User
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
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
 
Old May 16th, 2010, 06:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 16th, 2010, 10:13 AM
Authorized User
 
Join Date: May 2010
Posts: 70
Thanks: 4
Thanked 6 Times in 6 Posts
Send a message via Yahoo to GeneBuchite
Default

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
 
Old May 16th, 2010, 01:14 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old May 16th, 2010, 01:57 PM
Authorized User
 
Join Date: May 2010
Posts: 70
Thanks: 4
Thanked 6 Times in 6 Posts
Send a message via Yahoo to GeneBuchite
Default

OK I hadn't realized that yet. Thanks For the tip.
 
Old May 17th, 2010, 01:12 AM
Authorized User
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by GeneBuchite View Post
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fix string length Ivanchan Excel VBA 2 July 26th, 2007 08:55 AM
string-length problem alapati.sasi XSLT 3 July 4th, 2007 10:08 AM
Chap 3, "Length of String" richajos BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 February 25th, 2006 08:38 PM
How to obtain String length in twips mike123abc VB How-To 5 December 11th, 2003 01:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.