Results 1 to 11 of 11

Thread: Need help choosing the right control

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2013
    Posts
    312

    Need help choosing the right control

    Hi guys, i am trying to make a program which stores selected programs by user selection, and it will later store them in a database. What control would be best suited to list these programs? The user will need to select many items. I was going to use a listbox but its really limited, as you cant use tickboxes or anything like that on it. I don't want to waste time playing with this, so what control would be best recommended to achieve this?

    I also need to be able to get more items from the registry about the installed programs, such as; address to each programs .exe location, and each programs icon. But I am unsure of the best location to get them or where to start with this. Here is what I got so far...
    Code:
        Private Sub SrcAppsBtn_Click(sender As Object, e As EventArgs) Handles SrcAppsBtn.Click
            ListBoxPrograms.Items.Clear()
            Dim regkey, subkey As Microsoft.Win32.RegistryKey
            Dim value As String
            Dim regpath As String = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
            regkey = My.Computer.Registry.LocalMachine.OpenSubKey(regpath)
            Dim subkeys() As String = regkey.GetSubKeyNames
            Dim includes As Boolean
            For Each subk As String In subkeys
                subkey = regkey.OpenSubKey(subk)
                value = subkey.GetValue("DisplayName", "")
                If value <> "" Then
                    includes = True
                    If value.IndexOf("Hotfix") <> -1 Then includes = False
                    If value.IndexOf("Security Update") <> -1 Then includes = False
                    If value.IndexOf("Update for") <> -1 Then includes = False
                    If includes = True Then ListBoxPrograms.Items.Add(value)
                End If
            Next
        End Sub

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,988

    Re: Need help choosing the right control

    A datatable bound to a datagridview sounds right. It sounds like you have potentially several columns worth of data, one of which might be a checkbox. The DGV can handle all of that, and a datatable to a database is pretty straightforward.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2013
    Posts
    312

    Re: Need help choosing the right control

    Thanks Shaggy..

    Anyone else got anything else to get me started with this???

  4. #4

    Re: Need help choosing the right control

    If you don't want to do that (use a DGV+DataTable, despite it being pretty nice), you can either use a ListView, or the really nice ObjectListView (it's on SoureForge).

  5. #5
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Need help choosing the right control

    ListView



  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2013
    Posts
    312

    Re: Need help choosing the right control

    So now i got the right controls to use. now how can i get each installed programs location and its .exe path from the registry? i see "DisplayIcon" in the registry path above, maybe i can use that to get the icon location. But i still don't know how to find the programs launch file in the registry. Can anyone help me with this or is there an easier way to do it?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2013
    Posts
    312

    Re: Need help choosing the right control

    Anyone????

  8. #8
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Need help choosing the right control

    now how can i get each installed programs location
    See this



  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2013
    Posts
    312

    Re: Need help choosing the right control

    Thanks man, it's not quite what I was looking for, but its a pointer in the right direction though.

  10. #10
    Lively Member
    Join Date
    Nov 2011
    Posts
    97

    Re: Need help choosing the right control

    use classic controls from telerik , or there are many others choices search google

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2013
    Posts
    312

    Re: Need help choosing the right control

    Binarybot, thanks for the suggestion, but its kinda expensive right now.
    Quote Originally Posted by Mucker View Post
    Code:
        Private Sub SrcAppsBtn_Click(sender As Object, e As EventArgs) Handles SrcAppsBtn.Click
            ListBoxPrograms.Items.Clear()
            Dim regkey, subkey As Microsoft.Win32.RegistryKey
            Dim value As String
            Dim regpath As String = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
            regkey = My.Computer.Registry.LocalMachine.OpenSubKey(regpath)
            Dim subkeys() As String = regkey.GetSubKeyNames
            Dim includes As Boolean
            For Each subk As String In subkeys
                subkey = regkey.OpenSubKey(subk)
                value = subkey.GetValue("DisplayName", "")
                If value <> "" Then
                    includes = True
                    If value.IndexOf("Hotfix") <> -1 Then includes = False
                    If value.IndexOf("Security Update") <> -1 Then includes = False
                    If value.IndexOf("Update for") <> -1 Then includes = False
                    If includes = True Then ListBoxPrograms.Items.Add(value)
                End If
            Next
        End Sub
    Haven not worked with datagridview and binding sources before, i am a little lost as in how to or which control i should populate. If i populate the bindingsource, it should update the datagridview automatically. Right? if so, can someone show me how to alter my code to do that or point me to a decent tut?

    thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width