c# - Check ComboBox (Xceed WPF Toolkit), How to get short name to display from database? -


this first post , relative newbie regarding things programming related. hope patient me. have wpf application working on. current issue check combobox using. when make selections out of list pulled sqlite database file, full name of selection displayed. change , have short name database appear in combobox area while leaving long descriptive name in dropdown portion. thought working display , value member out, have yet working. can 1 or other changing column index reference sqlite db. combobox multi-select item , needs update selections made or cleared. below bit of code have populates combobox. unable attach image of data due low rep numbers. column 0 full descriptive name, column 1 has short name interested in displaying.

public void fill_modality()          {             sqliteconnection sqlitecon = new sqliteconnection(dbconnectionstring);             try             {                 sqlitecon.open();                 string query = "select * modality_list";                  sqlitecommand createcommand = new sqlitecommand(query, sqlitecon);                 sqlitedatareader dr = createcommand.executereader();                 while (dr.read())                 {                     string modname = dr.getstring(0);                     modality_select.items.add(modname);                 }                  dr.close();                 sqlitecon.close();             }             catch (exception ex)             {                 system.windows.messagebox.show(ex.message);              }         } 

thank may able provide.

patrick

addendum: thank folks replied above post. in reviewing suggestions provided, have found didn't quite capture in detail trying accomplish.

when click drop down, detailed description shows along side checkboxes. part fine, no issue here. looking this: when checkboxes selected, instead of detailed description showing in comma delimited string in collapsed combobox control, display short name in comma delimited string. data sqlite databasefile. table 2 columns, 0 detailed description, 1 short name.

if nothing else, think textbox filled short names long name counter part selected in combobox fine well. overall goal have short names available in string use elsewhere in project without causing confusion our abbreviations.

only select need database, unless table 2 columns, i'd avoid astrisk. use like:

select short_name, long_name modality_list 

then while iterating through them dr.getstring(0) used access short_name field , dr.getstring(1) long_name.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -