SYNTAX PROBLEM -----PLS HELP ME
-
Hi, i am working in windows application of C# i am using hash table. i want to add data to hash table from datatable named DTSchool. I have a school name in combobox. when iselect school in combo it takes the curresponding SchoolID from the datatable i want to know how to write code for that. i wrote like this List.Add(SchoolDT.Rows[cboSchool.SelectedIndex]["SchoolID"],cboSchool.Text.ToString()); .But it is not taking value from datatable.Please help me regarding this problem?
-
Hi, i am working in windows application of C# i am using hash table. i want to add data to hash table from datatable named DTSchool. I have a school name in combobox. when iselect school in combo it takes the curresponding SchoolID from the datatable i want to know how to write code for that. i wrote like this List.Add(SchoolDT.Rows[cboSchool.SelectedIndex]["SchoolID"],cboSchool.Text.ToString()); .But it is not taking value from datatable.Please help me regarding this problem?
I doubt this is a syntax problem. If it was the compiler would be complaining. You have a run time error.
sajin85 wrote:
cboSchool.Text.ToString()
Why are you calling ToString() on something that is already a string? Are the rows in the DataTable order the same way as the items in the combo box?
Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, db4o: An Embeddable Database Engine for Object-Oriented Environments, Mock Objects, SQL Server CLR Integration, Reporting Services ... My website
-
Hi, i am working in windows application of C# i am using hash table. i want to add data to hash table from datatable named DTSchool. I have a school name in combobox. when iselect school in combo it takes the curresponding SchoolID from the datatable i want to know how to write code for that. i wrote like this List.Add(SchoolDT.Rows[cboSchool.SelectedIndex]["SchoolID"],cboSchool.Text.ToString()); .But it is not taking value from datatable.Please help me regarding this problem?
Hi, Are you sure the indexes of the items in your combobox matches the row indexes in your datatable? Maybe posting a little bit more code might help to tackle your problem. Mark
Hybrid DSP: Digital processing and storage solutions. Hybrid GeoTools: Advanced GIS editing tools.