c# - Retrieve value from toolStripComboBox -


i have created toolstripcombobox , retrieve item list selection database this:

private void toolstripcombobox1_click(object sender, eventargs e)     {         toolstripcombobox1.combobox.valuemember = "month";         toolstripcombobox1.combobox.datasource = dbconnect.selectmonth(); //get month database     } 

the combobox display month database.

later i'm trying fetch selection combobox using selecteditem somthing this:

string monthselect = toolstripcombobox1.selecteditem.tostring(); 

however value monthselect = "system.data.datarowview"

any idea how value instead of system.data.datarowview?

got solution this. when using datasource toolstripcombobox :

toolstripcombobox1.combobox.valuemember = "valuemember";   toolstripcombobox1.combobox.datasource = datasource();  //retrieve value database combobox list 

toolstripcombobox1.selecteditem return customized view of datarow. in order value of current selection need use :

toolstripcombobox1.combobox.selectedvalue.tostring(); 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -