// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Drawing; using System.Windows.Forms; using Microsoft.Win32; namespace DefaultNamespace { public class MainForm : Form { private Button btn; private TextBox tb; public MainForm() { InitializeComponent(); } [STAThread] public static void Main(string[] args) { Application.Run(new MainForm()); } private void InitializeComponent() { tb = new TextBox(); btn = new Button(); SuspendLayout(); tb.Location = new Point(50, 50); tb.Size = new Size(400, 200); tb.Multiline = true; tb.Text = ""; btn.Location = new Point(50, 300); btn.Size = new Size(400, 50); btn.Text = "Hent"; btn.Click += new System.EventHandler(ButtonClick); ClientSize = new System.Drawing.Size(500, 400); Controls.Add(btn); Controls.Add(tb); Name = "Main Form"; ResumeLayout(false); } void ButtonClick(object sender, System.EventArgs e) { RegistryKey dir = Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("ASP.NET").OpenSubKey("1.1.4322.0"); String[] vals = dir.GetValueNames(); foreach(string v in vals) { string data = (string)dir.GetValue(v); tb.Text += (v + "=" + data + "\r\n"); } } } }