Results 1 to 9 of 9

Thread: Problem With combo-box ***(KIND A) RESOLVED ***

  1. #1

    Thread Starter
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611

    Problem With combo-box ***(KIND A) RESOLVED ***

    Whenever I fill a combo-box from a recordset (with this code):

    VB Code:
    1. While Not TempRS.EOF
    2.     Combo1.AddItem TempRS.Fields("sdOmsch"), TempRS.Fields("ndCode")
    3.     TempRS.MoveNext
    4. Wend
    ndCode = integer
    sdOmsch = string

    This is no problem, but whenever I (the code) try's to add the 27th item, it gives an error:

    Run-time error '5':
    Invalid procedure call or argument


    Does anybody have a clue
    Ow, yes ndCode is the primary key of that table
    Last edited by Lightning; Mar 1st, 2004 at 05:26 AM.
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  2. #2
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236
    Are you sure there is some data in the database?

    If its empty it will cause an error.

    VB Code:
    1. While Not TempRS.EOF
    2. If Not IsNull(CStr(TempRS.Fields)) Then
    3.     Combo1.AddItem TempRS.Fields("sdOmsch"), TempRS.Fields("ndCode")
    4. End If
    5.     TempRS.MoveNext
    6. Wend

    Not sure if I've pasted this correctly, I can't see your code but it checks to see if there is a valid entry.

  3. #3

    Thread Starter
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    Well yes there is a check. (and I know for shure there is some data in), it adds data, only where the index is more as 26 it raeses the error
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  4. #4
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    sdOmsch or ndCode are not Null?

  5. #5

    Thread Starter
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    Both are not NULL, the strange thing is that whenever I don't use the INDEX all works fine. But why can't I set the index to a higher value than 26???
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  6. #6
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    What's the data type of nCode in the database?

  7. #7
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Talking

    Is it possible that the index value you uccurs twice?
    Better to regret things you did, than those you didn't
    International Intelligence

  8. #8
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Originally posted by hassa046
    Is it possible that the index value you uccurs twice?
    Not if the primary key is already set at the database (No duplicates)

    Have to rush cant wait for your reply, but its probably because the index for the combobox is limited. Either use another contol (data combo, data list) or convert nCode to Integer, whichever works.
    Last edited by leinad31; Mar 1st, 2004 at 07:01 AM.

  9. #9

    Thread Starter
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    I kind a solved it. I don't use the index, but it still is strang
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

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