datagridview - Populate datagrid with items based on a name vb.net -
i have code gets me index of hidden combobox utilize index populate datagrid, want show items correspond text in lbl_test.text label.
private sub cbx_doctors_selectedindexchanged(sender object, e eventargs) handles cbx_doctors.selectedindexchanged lbl_test.text = cbx_doctors.selecteditem.tostring cbx_hidden.selecteditem = lbl_test.text lbl_hidden.text = cbx_hidden.selectedindex.tostring dim app = convert.toint32(lbl_hidden.text) dgv_1.datasource = appointmentlist end sub public class appointment property appointmentid string property appointmentdate string property time string property appointmentlength integer property doctorname string property patientname string property reason string end class
this requested portion of code responsible saving xml file:
'save xml dim objstreamwriter4 new streamwriter("..\..\..\appointments.xml") dim new xmlserializer(appointmentlist.gettype) a.serialize(objstreamwriter4, appointmentlist) objstreamwriter4.close()
it sounds want filter homecoming list based on 1 of fields equals lbl_test.text
- if right like:
private sub cbx_doctors_selectedindexchanged(sender object, e eventargs) handles cbx_doctors.selectedindexchanged dim doctorname = cbx_doctors.selecteditem.tostring cbx_hidden.selecteditem = doctorname lbl_hidden.text = cbx_hidden.selectedindex.tostring dgv_1.datasource = appointmentlist.where(function(apt) apt.doctorname = doctorname) end sub
vb.net datagridview
No comments:
Post a Comment