The issue would be how you're splitting the lines of the file in the first place. As you haven't shown us how you're doing that, we can only guess. Assuming that you have you just want a one-to-one mapping of lines in the file to items in the drop-down list, this is the most sensible way to load the data:
I've done some reading - someone has suggested I feed the reader into a TextBox first (a hidden textbox) and then into the Comobobox, but this doesn't seem necessary.
Is there a way I can simply knock off the last character displayed of every item in the Combobox, when it lists them in the drop down?
I've done some reading - someone has suggested I feed the reader into a TextBox first (a hidden textbox) and then into the Comobobox, but this doesn't seem necessary.
I suggest you never take advice from this person again. There is no reason to create a GUI control meant to display data to do simple string manipulation. Think of all the wasted overhead.
Originally Posted by mattkw80
Is there a way I can simply knock off the last character displayed of every item in the Combobox, when it lists them in the drop down?
Well you could do as jmcilhinney suggests, for one. The advantage of using the IO.File.ReadAllLines method is that it handles the creation and disposal of the reader used to read the text file.
Also, note that you added the characters yourself with the end of this line of code: TextLine = TextLine & objReader.ReadLine() & vbNewLine
vbNewLine is adding a carriage return/line feed combination.
Also, there is also a handy method of the string class called String.Trim
Bookmarks