Problem with Long Converstion


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Problem with Long Converstion

  1. #1
    Join Date
    Feb 2006
    Posts
    4

    Problem with Long Converstion

    Code:
    Dim intText1 As Long
            Dim intText2 As Integer
            Dim intText3 As Long
            intText1 = Val(Frm3.TextBox1.Text) 'Here is says  Conversion from string "" to type 'Long' is not valid.        
    intText2 = Val(Frm3.TextBox2.Text)
            intText3 = CStr(Val(Frm3.TextBox1.Text) * Val(Frm3.TextBox2.Text))
            Frm3.TextBox3.Text = intText3
    THE BOLD part is where it points to giving me a Invalid conversion error.

  2. #2
    Join Date
    Apr 2004
    Posts
    50
    Have you tried
    intText1 = Ctype(Frm3.TextBox1.Text, Long)

  3. #3
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    This works for me:
    Dim intText As Long = CType(Val(""), Long)
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  4. #4
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    What is the value of Frm3.TextBox1.Text? Use the debugger...
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

Similar Threads

  1. Change NT service config (disabled -> enabled)
    By pavel in forum VB Classic
    Replies: 0
    Last Post: 10-17-2001, 09:06 PM
  2. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 11:50 PM
  3. Problems with NetAddUser
    By Jeff Morgan in forum VB Classic
    Replies: 2
    Last Post: 02-13-2001, 11:49 AM
  4. Adding New NT User Account
    By John Whitney in forum VB Classic
    Replies: 2
    Last Post: 02-02-2001, 12:15 AM
  5. Trying to print a PDF File from VB
    By Kunal Sharma in forum VB Classic
    Replies: 2
    Last Post: 04-25-2000, 04:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center