In my form, there is form named frmTeacher.
I filled its table called tbl_Teacher using frmTeacher form.
there is another form called frmTeacherSearch.
this form is for viewing the data of tbl_teacher(using condition where employeeId=@employeeId)
this form has a combobox and a gridview.
this is my form:-
The purpose of this form:-
combobox: employeeId from tbl_Teacher to be filled in it on form_LoadEvent().
You can see i did the code for load the employeeId.
Now my need is to fill datagridview1 with the related data that I select in combobox.
i.e , when I select 1, datagridview1 to be filled the combobox selected index's employeeName,joiningDate and Designation.
please help me in this topic.

Posted Jul 8, 2013, 2:51 AM
var empId = cmbSearchBy.Items[cmbSearchBy.SelectedIndex]
Later to do typecast before adding into sql param list.
Iftikar HussainPosted Jul 8, 2013, 2:36 AM
Regards,
Iftikar
Bineesh ViswanathPosted Jul 8, 2013, 2:20 AM
please explain the cause and for this error.
here my error:-
Posted Jul 8, 2013, 2:03 AM
I hope you're going right path.
On the combobox selected index change event, fetch the currently selected item text, and connect the database, fetch the information, fill into the dataset (datatable) and bind into the gridview.
Iftikar HussainPosted Jul 8, 2013, 1:59 AM
You can achieve this by handling selected index changed event of the dropdown as shown below
just go to your form and double click the dropdown. The below event will be generate automatically
In your Form.cs
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 8, 2013, 1:57 AM
sample query:
select employeeName,joiningDate,Designation from Teacher where employeeId=@employeeId