I am adding line entries in a .ini file. The problem is, I am creating duplicate lines in the file, which I do not want to do.
I searched this issue online, and the consensus is to use an array, loop through for duplicates and create a new file.
However, being so new at this and teaching myself how to code no less, I am at a dead end.
This is not a school project, it is something I am doing for work on my own time. I have all of my code done for the program except for this last step.
Can anyone help me use an array with a text file and remove duplicates in vb.net?
This is what I have for my code to enter data in the ini file. It puts two entries in one file.
Dim objReader As New StreamReader("c:\windows\odbc.ini") Dim line As String = "" Dim temp As String = "" Dim index As Integer = 0 While Not objReader.EndOfStream line = objReader.ReadLine() If index = 0 Then temp = temp & line Else temp = temp & vbCrLf & line End If If line = "[ODBC 32 bit Data Sources]" Then temp = temp & vbCrLf & ComboBox2.Text & "=DataDirect 4.0 Oracle (32 bit)" End If index = index + 1 End While temp = temp & vbCrLf & "[" & ComboBox2.Text & "]" & vbCrLf & "Driver32=C:\Program Files\Merant\ODBC40\Drivers\IVOR817.DLL" objReader.Close() File.WriteAllText("c:\windows\odbc.ini", temp) End Sub