string DisplayName = null; string RegistryKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\UnInstall"; DataTable dt = new DataTable(); dt.Columns.Add("Software Name", typeof(string)); dt.Columns.Add("Software Version", typeof(string)); dt.Columns.Add("Software Publisher", typeof(string)); DataRow dr = null; using (RegistryKey RegisrtyKey1 = Registry.LocalMachine.OpenSubKey(RegistryKey)) { foreach (var varName in RegisrtyKey1.GetSubKeyNames()) { using (RegistryKey RegistryKey2 = RegisrtyKey1.OpenSubKey(varName)) { DisplayName = Convert.ToString(RegistryKey2.GetValue("DisplayName")); if (DisplayName.Equals("")) { continue; } else { dr = dt.NewRow(); dr[0] = (string)RegistryKey2.GetValue("DisplayName"); if (RegistryKey2.GetValue("DisplayVersion") == null) dr[1] = ""; else dr[1] = (string)RegistryKey2.GetValue("DisplayVersion"); dr[2] = (string)RegistryKey2.GetValue("Publisher"); dt.Rows.Add(dr); } } } } GridSoftwares.Columns.Clear(); GridSoftwares.DataSource = dt;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)