Loading Values into the Registry

Joined
Jan 10, 2007
Messages
43,898
Location
In The Machine
Here's my code

icon-quote.gif
code wrote: Dim ofd As OpenFileDialog = Me.OpenFileDialog1
******* If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
*********** Dim sr As New StreamReader(ofd.FileName)
*********** Dim currentLine As String = String.Empty
*********** Dim infoArr(0) As String
*********** Dim index As Integer = -1
*********** While sr.Peek -1
*************** index += 1
*************** Array.Resize(infoArr, infoArr.Length + 1)
*************** infoArr(index) = sr.ReadLine()
*************** 'Console.WriteLine(currentLine)
*********** End While
*********** sr.Close()
*********** sr.Dispose()

*********** For Each info As String In infoArr
*************** Try
******************* Dim newKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Soft Name\Key", True)
******************* newKey.SetValue(info.Substring(0, info.IndexOf(":")), info.Substring(info.IndexOf(":") + 1))
******************* Me.lbInfoList.Items.Add(Me.txtEmail.Text)
******************* newKey.Close()
*************** Catch ex As Exception
*************** End Try
*********** Next
*********** MsgBox("Your info was imported!", MsgBoxStyle.Information)
******* End If

When I try import a txt file with 70,000 lines, the program goes to (Not Responding) and it asks me if I want to close vshots.exe....whats a good way to import a lot of data into the registry?

Much thanks.


More...

View All Our Microsoft Related Feeds
 
Back
Top