Results 1 to 5 of 5

Thread: Item not Found in Collection

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211

    Item not Found in Collection

    Ok, this is my first .net program and it is converted from vb6

    I searched but could not find the answer.

    Code:
                      
    For Count = 1 To SQL_RS.Fields.Count
                    Me.List_of_Fields.Items.Add(SQL_RS.Field(Count).Name)
    Next
    Count is defined as long.

    I get a item not in collection error when count is 1
    I can see the value in the quickwatch window

    Heeelp

    Simon

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    I think that it may be a zero based collection. Try going from 0 to .Count -1 and see if that works.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211
    Yes it is, but I tried hard coding 1 in there and I get a value
    I use a long field with a value 1 and I get item not found in collection.

    Simon

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Posts
    211
    got it, I have to use schema's

    and .net's debugger SUCKS !!!!!!!!

    Simon

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    NOTE: Ints have changed form VB6 to .NET.
    In VB6, an integer is now a short in .NET.
    In VB6, what was a long is now an integer in .NET
    Try changing it from a long type to an integer type.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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