Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setSelectedItem() for ComboBoxes  RSS feed

 
Sandeep DSouza
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have created a combo box ( comA) which has objects with attributes "id" and "name" .In my Combo box only the name is displayed but based on what is selected I am able to get the "id".
Now I have another "ID" which comes from the database and i need to comA.setSelectedItem() when "id" = "ID"
Can someone help me with this one
thanks.
 
Sarone Thach
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put your objects in a Vector and when you get an ID, search in that Vector for the object.
if the object is valid, then call the setSelectedItem(objectFound);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!