c# - combo box acces level -
i making pos system , , doing employee log, allows set information of employee working in store. want set combo box read following numbers: 1
, 2
, 3
, 4
- access level different parts of program.
how make when 1 selected, employee access level variable turns 1?
public employee_info() { initializecomponent(); } private void textbox4_textchanged(object sender, eventargs e) { int num; try { num = int.parse(textbox4.text); label1.text = num.tostring(); } catch (exception exc) { label5.text = "please enter number"; } } private void employee_info_load(object sender, eventargs e) { } private void button1_click(object sender, eventargs e) { string name = textbox1.text; int number = convert.toint32(textbox2.text); string emial = textbox3.text; } private void combobox1_selectedindexchanged(object sender, eventargs e) { } }
}
this pop screen add of employee info , simple , 2 thing missing combo box selection access level , other not important add info on list box , name of employee appears click on same pop appears , can see or edit informacion, first "real project" far college
if question how value combobox, maybe help:
string item = combobox.selecteditem.tostring(); int value = int.parse(item); employeeaccesslevel = value;
you may want use int32.tryparse, or implement error handling well.
or if trying figure out how update when selection changes, try looking combobox.selectedindexchanged event
Comments
Post a Comment