Load Start Up Program in VB.NET

This tutorial will teach you how to create a program that can load all the start up programs in your computer and loads the total number of it using VB.NET. Now, let's start this tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application. 2. Next, add only one ListView with two Columns and named it as ListView1, one button for loading the startup programs, and one label to retrieve the total number of startup programs. You must design your interface like this: output 3. Now, we will do the coding. We will first import the Microsoft.Win32 library to access the registry namespace.
  1. Imports Microsoft.Win32
Then, we will declare some variables that we will going to use to retrieve those startup programs with the number of programs their.
  1. Dim g As RegistryKey
  2. Dim appname As String
  3. Dim newlistv As New ListView
  4. Dim a As String, m, u, Numberofstartupprograms As Int32
Lastly, have this code for your button that it will load all the startup programs and retrieved the total number of it.
  1. Private Sub ButtonLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoad.Click
  2.  
  3. 'clear the listview and the newlistview
  4. Numberofstartupprograms = 0
  5. ListView1.Items.Clear()
  6. newlistv.Items.Clear()
  7.  
  8. ' accessing the local machine of the registy
  9. g = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
  10.  
  11. ' get all the startup programs
  12. For Each item In g.GetValueNames
  13. Numberofstartupprograms += 1
  14. 'get the path of the name
  15. appname = CStr(g.GetValue(item))
  16. Application.DoEvents()
  17.  
  18. ' added the startup programs to the listview
  19. ListView1.Items.Add(appname).SubItems.Add(item)
  20. newlistv.Items.Add(item)
  21.  
  22. 'retrieved the total number of programs on the label
  23. Label1.Text = "Total Start-up: " & Numberofstartupprograms
  24. Next
  25. End Sub

Output:

output Download the source code and try it. For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment