perhaps there is some sort of logic error i am missing here but i cannot figure out whats going wrong. I wrote this simple for loop to write the contents of a ComboBox to a txt file. The process works but for some reason it is doing the job twice. I have tried a regular for loop, a for each loop and a while loop and i keep getting the same result. What am i doing wrong here?
Private Sub OnApplicationExit(ByVal sender As Object, ByVal e As EventArgs) Dim histWrite As New StreamWriter("history.txt", True) For Each item As Object In cmbo_history.Items histWrite.WriteLine(item) Next histWrite.Close() End Sub
and this is always my result (duplicates are not allowed to be entered into the comboBox so this has to be a problem with the loop
test1 test2 test1 test2
Any help would be greatly appreciated. Thanks all