I am having a little hard time finding anywhere the answer to
this question by myself, while advancing further in my code, but at this time im nowhere else to go further if I don't solve it, and here you got me, aksing for help.
I think a simple yes/no answer can make me happy if there is nothing better. But for that, probably I should explain every bit of what I want:
I have a combobox which I want it to be filled and display with the names of all the files in a selected directory or many different ones, but when selecting an item in the combobox, it returns the whole path to the file. I feel like i should explain more of the functionality of the combobox and/or the program so it is justified the why i don't think using a DataBase its a good idea, but it probably will be a lot of worthless words, so I will limit myself to say that I will <b>not</b> use a database because that would be too much slow for the purpose.
Then, finally, my question is: Is there any simplier way to have a display member AND a value member within the combobox without a database, connection string, etc?
To make it faster, i had this idea of code, so if the answer is no, AndAlso the answer is simplier And/Or faster/code-optimal than this, I would appreciate the hint (and code snippet) very much.
Private ColPaths() As String
Private ColSelPath As String
Private Sub FillCboBox()
For Each Str As String In Directory.GetFiles(InteractiveMap.GalleriesPath, _
ReDim Preserve ColPaths(cboCollection.Items.Count - 1)
ColPaths(cboCollection.Items.Count - 1) = Str
Private Sub cboCollection_SelectedIndexChanged(sender As Object, e As EventArgs) _
ColSelPath = ColPaths(cboCollection.SelectedIndex)
I should add that this is only one of 3 different comboboxes that i want to fill and use with a very similar methood, unless one is with the content from a text file(easy for user to edit manually also, if wanted/needed) and the other one is with the combination of files/paths and content of the same kind of editable text files, that is one of the many reasons of why a database would not work for me.
PS. I am new at this site, so I don't know yet how do things work around here, i assume similar to other forums, but i have seen some different and very interesting things (like the workspace). Whatever, its also because of that, that i want to ask you about the "Preview" shown below here, the text editor, i cant see anything but an orange-line rectangle with "..." in it.
Is my browser (chrome) not well for working here? is the site? or what could it be? (sorry if this question is not in the correct place)
PS2. This code is in vb.net but I welcome C# answers too.
Im working in VS2013 and the framework of this project (because of its simplicity and that i want it to be very compatible) its 2.0
Finally, sorry for my horrible english, and thank you in advance.