Imports Microsoft.Win32
Dim g As RegistryKey Dim appname As String Dim newlistv As New ListView Dim a As String, m, u, Numberofstartupprograms As Int32
Private Sub ButtonLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoad.Click 'clear the listview and the newlistview Numberofstartupprograms = 0 ListView1.Items.Clear() newlistv.Items.Clear() ' accessing the local machine of the registy g = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) ' get all the startup programs For Each item In g.GetValueNames Numberofstartupprograms += 1 'get the path of the name appname = CStr(g.GetValue(item)) Application.DoEvents() ' added the startup programs to the listview ListView1.Items.Add(appname).SubItems.Add(item) newlistv.Items.Add(item) 'retrieved the total number of programs on the label Label1.Text = "Total Start-up: " & Numberofstartupprograms Next End Sub