vb.net - Visual Basics, Store comboBox value in variable -
i want save combobox value in variable.but whenever change combobox value value gets set null, , selected index shows '-1'.below code.
private sub selectedindexchanged(sender object, e eventargs) handles combobox1.selectedindexchanged dim form createevalform = new createevalform //windows form dim str string = form.combobox1.selectedindex messagebox.show(str) //shows null dim openingid integer = val(form.combobox1.text) end sub
could please suggest solution?
private sub selectedindexchanged(sender object, e eventargs) handles combobox1.selectedindexchanged dim str string = combobox1.selectedindex messagebox.show(str) dim openingid integer = val(combobox1.text) end sub
does work? if wanted value combobox's selected value, should try following:
dim openingid integer = val(combobox1.selectedvalue)
Comments
Post a Comment