Results 1 to 4 of 4

Thread: Weird combobox problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    210

    Weird combobox problem

    Hi! I am experiencing a very strange problem with my combobox. I am currently using the code

    VB Code:
    1. Dim rs As New ADODB.Recordset()
    2.  
    3. cboObject.Items.Clear()
    4. rs.Open(strQuery, Cnn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
    5. If Not rs.EOF Then
    6.     rs.MoveFirst()
    7.             Do While Not rs.EOF
    8.                 cboObject.Items.Add(rs.Fields(0).Value)
    9.                     rs.MoveNext()
    10.             Loop
    11. End If
    12. rs.Close()

    Whenever I run the system, the combobox returns as blank. Here's the weird part, there is a long list of blank entries, if I chose the second one, it will suddenly appear in my combobox. It is like they are invisible or something. The second weird part is after a few minutes the list will suddenly become visible again. I've never encountered this problem before and neither have my coworkers. Please help!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Weird combobox problem

    Don't use a Recordset for a start, and don't use ADO at all. Use ADO.NET, retrieve the data into a DataTable and assign that to the DataSource of the ComboBox, or else use a DataReader to get the values one by one and add them.

    Having said that, if you've got blank entries then you got entries. Either you've set the ForeColor and the BackColor to the same value, which is unlikely, or it may something else interfering. Do you have any McAfee products installed? There's a well-documented bug that causes text to disappear in .NET apps.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    210

    Re: Weird combobox problem

    Is there any way to go around the McAfee bug? I'm afraid that is the standard Virus Scanner for our company.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Weird combobox problem

    They have posted a patch on their Web site. I'm sure someone has posted a link at least once before. Try search the forum first, then the McAfee site.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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