Problems binding a dataset to a combobox
-
I just can't seam to figure out why the following code is not working. I would be thankful for any help. Thanks, JefferyS :( CODE: string folderPath = "C:\\My Documents\\Visual Studio Projects\\MyDroidEngineer\\Data\\"; DataSet myDS = new DataSet(); myDS.ReadXml(folderPath + "planets.xml"); cboPlanets.DataSource = myDS.Tables["planet"]; cboPlanets.DisplayMember = "description"; cboPlanets.ValueMember = "swgcraft_id"; I get no errors and just a blank combo box I have used a temp datagrid to check the dataset and it displays correctly. Top Part of XML File: Corellia Dantooine Dathomir
-
I just can't seam to figure out why the following code is not working. I would be thankful for any help. Thanks, JefferyS :( CODE: string folderPath = "C:\\My Documents\\Visual Studio Projects\\MyDroidEngineer\\Data\\"; DataSet myDS = new DataSet(); myDS.ReadXml(folderPath + "planets.xml"); cboPlanets.DataSource = myDS.Tables["planet"]; cboPlanets.DisplayMember = "description"; cboPlanets.ValueMember = "swgcraft_id"; I get no errors and just a blank combo box I have used a temp datagrid to check the dataset and it displays correctly. Top Part of XML File: Corellia Dantooine Dathomir
Only thing I can suggest you with the code && info you gave is to try with: // cboPlanets.DataSource = myDS; cboPlanets.DisplayMember = "planet.description"; cboPlanets.ValueMember = "planet.swgcraft_id"; // Instead of what you wrote for those tree lines. If that doesn't solve drop solution somewhere and give link or give more info ;) c-ya
-
Only thing I can suggest you with the code && info you gave is to try with: // cboPlanets.DataSource = myDS; cboPlanets.DisplayMember = "planet.description"; cboPlanets.ValueMember = "planet.swgcraft_id"; // Instead of what you wrote for those tree lines. If that doesn't solve drop solution somewhere and give link or give more info ;) c-ya
-
I just can't seam to figure out why the following code is not working. I would be thankful for any help. Thanks, JefferyS :( CODE: string folderPath = "C:\\My Documents\\Visual Studio Projects\\MyDroidEngineer\\Data\\"; DataSet myDS = new DataSet(); myDS.ReadXml(folderPath + "planets.xml"); cboPlanets.DataSource = myDS.Tables["planet"]; cboPlanets.DisplayMember = "description"; cboPlanets.ValueMember = "swgcraft_id"; I get no errors and just a blank combo box I have used a temp datagrid to check the dataset and it displays correctly. Top Part of XML File: Corellia Dantooine Dathomir
I think you need to call DataBind() method of the combobox after setting the properties.
-
I just can't seam to figure out why the following code is not working. I would be thankful for any help. Thanks, JefferyS :( CODE: string folderPath = "C:\\My Documents\\Visual Studio Projects\\MyDroidEngineer\\Data\\"; DataSet myDS = new DataSet(); myDS.ReadXml(folderPath + "planets.xml"); cboPlanets.DataSource = myDS.Tables["planet"]; cboPlanets.DisplayMember = "description"; cboPlanets.ValueMember = "swgcraft_id"; I get no errors and just a blank combo box I have used a temp datagrid to check the dataset and it displays correctly. Top Part of XML File: Corellia Dantooine Dathomir
Thanks for all the suggestions. I figured out what was wrong and it wasn't the code. You can't set the sorted property on the combobox to true when using a dataset. I don't know why it didn't give me an exception error. I hope my folly helps someone not spend hours and hours trying to figure out why it was not working. Thanks again for all the help. Thanks, JefferyS :-D