Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

String length question

Posted on 2007-08-10
8
Medium Priority
?
183 Views
Last Modified: 2010-04-23
Can someone tell me why the following code computes 4 instead of 5 for the following code?:

 Dim IDNum As Integer
        Dim strlength As Integer

        IDNum = 88600

        'MsgBox(IDNum)
        strlength = Len(IDNum)

       

        MsgBox(strlength)
0
Comment
Question by:John Gates, CISSP
8 Comments
 
LVL 6

Accepted Solution

by:
hatem72 earned 2000 total points
ID: 19671569

Hi,

        strlength = Len(IDNum.ToString)
0
 
LVL 39

Expert Comment

by:appari
ID: 19671583
len returns number of bytes occupied by the variable.
try
strlength = Len(IDNum.tostring)
0
 
LVL 39

Expert Comment

by:appari
ID: 19671589
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Svetlin_Panayotov
ID: 19671629
Or this way - more .NET, less VB :)
strlength = IDNum.ToString().Length
0
 
LVL 33

Expert Comment

by:hongjun
ID: 19671633
TRy this

strlength = IDNum.ToString().Length
0
 
LVL 39

Expert Comment

by:appari
ID: 19671644
i think he is asking for
Can someone tell me why the following code computes 4 instead of 5 for the following code?:

0
 
LVL 18

Author Comment

by:John Gates, CISSP
ID: 19671693
Wow I think my brain was left at home today.  Thanks to all!
0
 
LVL 6

Expert Comment

by:hatem72
ID: 19671703

Glad i could Help ...
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question