I am new to Vb.net so I will need some handholding. I have been searching everywhere but can't find what I need.
I'm creating an app that has two forms.
Each form has two comboboxes.
The comboboxes are populated via a list and the list is populated by reading a text file for each combobox.
The second form is called from the main form to modify the entries in the comboboxes.
When I select the displaymember in the combobox a value corresponding to that entry is displayed in the text box.
Now here is what I need.
I need to be able to append new values to the list so when focus is returned to the main form the new value is present. I'm using a combobox and a textbox on the second form as the import.
The combobox is used to either select a present value to be able to modify the value in the textbox, or is used to add a new list element.
Secondly at the time the new values are entered into the list, I need these values to be written to the text file as well, so the new element can be available in the list the next time the app is started.
The format of the text file is
Here is the code that populates one of the comboboxes, the second list is basically the same but it has an additional value
Private Sub LoadTCComboBoxes() Try For Each ctl As Control In Me.gboTradeClass.Controls If TypeOf ctl Is ComboBox Then tradeList = TradeClassDB.GetTradeList DirectCast(ctl, ComboBox).DataSource = tradeList DirectCast(ctl, ComboBox).DisplayMember = "TradeClass_Description" DirectCast(ctl, ComboBox).SelectedIndex = -1 End If Next Catch ex As Exception MessageBox.Show(ex.Message, ex.GetType.ToString) End Try End Sub
I do have another issue and that is sorting the displaymember and other values in the combobox so they are in alphabetical order with thier associated values.
Thanks in advance. I hope I wasn't too long winded.
Edited 4 Years Ago by CoderNH: n/a