Código: Seleccionar todo

  private void PopulateListView()
        {
            List<Common_Tools.ProgramInfo> listProgInfo = new List<Common_Tools.ProgramInfo>();

            
            this.listViewProgs.Items.Clear();

          
            Regex regex = new Regex("", RegexOptions.IgnoreCase);

            if (this.textBoxSearch.ForeColor != SystemColors.GrayText)
            {
                StringBuilder result = new StringBuilder();
                foreach (string str in this.textBoxSearch.Text.Split(' '))
                {
                    result.Append(Regex.Escape(str));
                    result.Append(".*");
                }

                regex = new Regex(result.ToString(), RegexOptions.IgnoreCase);
            }

            // Get the program info list
            using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
            {
                if (regKey != null)
                {
                    foreach (string strSubKeyName in regKey.GetSubKeyNames())
                    {
                        using (RegistryKey subKey = regKey.OpenSubKey(strSubKeyName))
                        {
                            if (subKey != null)
                                listProgInfo.Add(new Common_Tools.ProgramInfo(subKey));
                        }
                    }
                }
            }

            
            if (Utils.Is64BitOS)
            {
                using (RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"))
                {
                    if (regKey != null)
                    {
                        foreach (string strSubKeyName in regKey.GetSubKeyNames())
                        {
                            using (RegistryKey subKey = regKey.OpenSubKey(strSubKeyName))
                            {
                                if (subKey != null)
                                    listProgInfo.Add(new Common_Tools.ProgramInfo(subKey));
                            }
                        }
                    }
                }
            }
            

        
            foreach (Common_Tools.ProgramInfo progInfo in listProgInfo)
            {
                ListViewItem lvi = new ListViewItem();

               
                if (!string.IsNullOrEmpty(progInfo.DisplayName))
                    lvi.Text = progInfo.DisplayName;
                else if (!string.IsNullOrEmpty(progInfo.QuietDisplayName))
                    lvi.Text = progInfo.QuietDisplayName;
                else
                    lvi.Text = progInfo.Key;

                
                lvi.SubItems.Add(((!string.IsNullOrEmpty(progInfo.DisplayName)) ? (progInfo.Publisher) : ("")));

                
                if (progInfo.InstallSize > 0)
                    lvi.SubItems.Add(Utils.ConvertSizeToString((uint)progInfo.InstallSize));
                else if (progInfo.EstimatedSize > 0)
                    lvi.SubItems.Add(Utils.ConvertSizeToString(progInfo.EstimatedSize * 1024));
                else
                    lvi.SubItems.Add("");

                if ((!string.IsNullOrEmpty(progInfo.DisplayName))
                    && (string.IsNullOrEmpty(progInfo.ParentKeyName))
                    && (!progInfo.SystemComponent))
                {
                    if (progInfo.Uninstallable)
                        lvi.ImageKey = "OK";
                    else
                        lvi.ImageKey = "ERROR";

                    
                    lvi.Tag = progInfo;

                    if (regex.IsMatch(lvi.Text))
                        this.listViewProgs.Items.Add(lvi);
                }
            }

            this.listViewProgs.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Esta es una funcion si no la entienden dejen su comentario y con gusto se las explicare

Despues publico una dll que les ayudara a la apariencia de sus aplicaciones en C# y VB.NET
Responder

Volver a “VB/.NET”