CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2001
    Posts
    45

    How to convert String to Integer in VB6?

    As the title, how could I convert the String into Integer in VB6?

    Say:

    Dim str As String
    Dim num As Integer

    str = "12345"

    How could I set the integer value to num (12345) here ?

    Thanks!
    Jim Cheng


  2. #2
    Join Date
    Apr 2001
    Posts
    2

    Re: How to convert String to Integer in VB6?

    Dim str As String
    Dim num As Integer

    str = "12345"
    num = val(str)


  3. #3
    Join Date
    Apr 2000
    Posts
    737

    Re: How to convert String to Integer in VB6?


    dim str as string
    dim num as Integer

    num = CInt(str)




    you might want to use IsNumeric function to check if the string is a valid numeric value first before convert it.

    HTH

    cksiow
    http://vblib.virtualave.net - share our codes



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured