Connecting Tech Pros Worldwide Forums | Help | Site Map

read value from combobox.

chelvan's Avatar
Member
 
Join Date: Aug 2008
Location: Colombo 06, Srilanka
Posts: 87
#1: Oct 7 '08
hi all

i face problem reading the JComboBox's selected item to a string variable.
i'm trying like this;

Expand|Select|Wrap|Line Numbers
  1. String str=cmbname.getSelectedItem();
  2.  
its says error.
so whats the way to read the selected item.


thanks chel-1

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Oct 7 '08

re: read value from combobox.


If you read the Javadocs for that class you will see that that method returns an Object.
Reply