CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: integers

  1. #1
    Join Date
    Apr 2001
    Posts
    11

    integers

    i am tring to set integers but i am having a problem with it. I am using the lines
    dim LP,TP,ZP as integer but when i try to use this it does no work is it because i am referring them to the text inside a textbox. can it be done. please help


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: integers

    Actually:
    dim LP, TP, ZP as integer statement will only set ZP as integer while LP and TP set to VARIANT.

    Not very clear with your question but if you're trying to convert a text from a textbox into an integer, than use CINT() or CLNG() such as below:

    Dim LP as Integer
    LP = CInt(Text1.Text)

    Do note that CINT() will throw an exception if the text inside Text1 textbox cannot be converted to a number.

    Better to use IsNumeric() function to check if the text can be converted or not.

    -Cool Bizs

    Good Luck,
    -Cool Bizs

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