Hi i am trying to fetch the details from the 2nd sheet of excel and load the values into the combobox. Once the user selects the value fromn the combobox it will be saved in the 1st sheet of excel. I am finding difficulty in loading the values into the combobox by fetching it from the 2nd sheet of excel.
Job PO Code
Select NA NA
ABC 3818 1322548
DEF 3818 312817
Above is the format stored in the 2nd sheet of excel. This should automatically load to the combobox of winforms.
Thanks in Advance.
What I have tried:
for (int index = 2; index <= lastRow; index++)
{
System.Array MyValues = (System.Array)MySheet.get_Range("A" + index.ToString(), "L" + index.ToString()).Cells.Value;
EmpList.Add(new Employee
{
SAPID = MyValues.GetValue(1, 1).ToString(),
EmployeeName = MyValues.GetValue(1, 2).ToString(),
ISN = MyValues.GetValue(1, 3).ToString(),
Name = MyValues.GetValue(1, 4).ToString(),
Onsite_Offshore = MyValues.GetValue(1, 5).ToString(),
Description = MyValues.GetValue(1, 6).ToString(),
PO = MyValues.GetValue(1, 7).ToString(),
Code = MyValues.GetValue(1, 8).ToString(),
WeeklyHours = MyValues.GetValue(1, 9).ToString(),
End_Date =Convert.ToDateTime(MyValues.GetValue(1, 10)),
NoOfLeaves = Convert.ToInt32(MyValues.GetValue(1, 11)),
Remarks = MyValues.GetValue(1, 12).ToString()
});
}