I've problem with reading a text file and using it in textbox and combobox combination. I've got text file ( which I open easly ) where the data is presented like this:

English cat dog cow
French chat chien vache

What I want to do is to - from combobox you choose first column (option one is English etc) and than in three different textboxes you get like cat in first etc.
What I have right now - I can open file, fill the combobox as I want, but don't know how to fill textboxes.

I don't know if I explained it understandable but anyway how can i solve my problem ?

Edited by bosnian.magic

1 Year
Discussion Span
Last Post by tinstaafl

With seeing the relevant code, it's hard to come up with a definitive answer, one thing that may help, is to use a custom class that contains fields/properties for the different parts of the data, and a ToString overload that returns the language. When you read the file populate a collection of this class with the data. Now to fill the combobox set the datasource property to the collection. In the handler for the SelectedIndexChanged event cast the selected item back to the class it came from, since the combobox has cast it to type Object. Now you have access to the relevant strings to put into the textboxes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.