Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 15th, 2003, 04:11 PM
TwistedQ TwistedQ is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Canada
Posts: 7 TwistedQ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy ComboBox problems????

Can anyone tell me how I can have a combobox reflect data that is in my database?

Example. tblModel contains PK->Model_ID, - autonumber and ModelDesc - text. Now the table holds of course, a model number and the description of that model number. I have no problem filling the combobox, it is when I set the box to a desired ModelID .


My code is such...

cboModel.ListIndex = rsModel!ModelID

This code works fine if your table entries are never deleted , everything works great but if you delete a model, say no.1 then your tblModel.ModelID now starts at 2, this is where the combobox screws up because if you try to use ListIndex with only the one entry in the table, you get an error trying to send an invalid value.

My question is how do I use the ItemData property to use the ModelDesc and set my combobox to that rather than the short coming of the ListIndex?

If I have confused you with my post, its only because I am learning VB and although I know what I need to do, I am having a hard time explaining what I am trying to do.

Hopefully someone can understand my gibberish.

Thanks in advance.

Reply With Quote
  #2  
Old December 10th, 2003, 04:40 AM
williamcrawley williamcrawley is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: uk
Posts: 91 williamcrawley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
The only way to ensure this is to delete the entry from the combo at the same time you delete from the database. If you deliberately do not want to delete from the combo, then you should re-design your app so that perhaps you have a second combo listing those that have been deleted and simply move the deleted entry from the original combo to the combo holding those that have been deleted.

Reply With Quote
  #3  
Old December 10th, 2003, 01:56 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,174 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 27 m 59 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
have you tried clearing the list and then reloading it completely. I normally don't handle combo boxes in this way, so I'm really just guessing.
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > ComboBox problems????


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway