No default member found for type 'Integer'


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: No default member found for type 'Integer'

  1. #1
    Join Date
    Feb 2008
    Posts
    21

    No default member found for type 'Integer'

    I'm trying to compare an integer to a integer on a binding source:

    Dim a As Integer = pickup.PickUpID
    Dim b As Integer = CInt(BindingSource.Current("PickUpID"))
    If a = b Then...

    On line 2 I get "No default member found for type 'Integer'"

    I've tried to Integer.Parse it, and CINT it, and google it, yet no success.

    Thanks for any help in advance.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Assuming the underlaying binding source is a database field, what is the field type of "PickUpId"?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Feb 2008
    Posts
    21
    Its an integer. And the first line works without any problems.

    For some reason the data from the binding source doesn't want to compare. But when I check it is says {Integer}

  4. #4
    Join Date
    Feb 2004
    Location
    Longueuil, Québec
    Posts
    577
    First, you should have a variable to reference your BindingSource. The way the code is writte, it tries to reference the class directly. Current is not a Shared (static) property, so it cannot be call on the class.

    Second, I have found with experience that direct assignment in a declaration does not always work. Have you tried this:

    Dim b As Integer
    b = CInt(variable.Current("PickUpID"))

    CInt has also failed me a couple of time in the 6 years I have been working in .NET, while the Convert class always work. It is also preferred, since it is the .NET way, not the VB way, and can be used in all languages:

    b = Convert.ToInt32(variable.Current("PickUpID"))
    Jacques Bourgeois
    JBFI
    http://www3.sympatico.ca/jbfi/homeus.htm

Similar Threads

  1. Replies: 0
    Last Post: 11-17-2000, 06:43 AM
  2. Replies: 0
    Last Post: 11-16-2000, 11:50 PM
  3. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 12:11 PM
  4. Replies: 0
    Last Post: 06-01-2000, 03:10 PM
  5. Trying to print a PDF File from VB
    By Kunal Sharma in forum VB Classic
    Replies: 2
    Last Post: 04-25-2000, 03: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