Here is the code which is using the Registry class but this is in C#. I hope you can convert to VB.Net. The code commented is using Xml file as It was reading data from Xml file but later in the section it is using registry class. It is savign the settings(width, height) of a form in the registry and then retrieving it when the form loads. I hope that helps.

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Microsoft.Win32; namespace WindowScreenC { /// /// Summary description for Form1. /// /// public class RegistrySettings : System.Windows.Forms.Form { private int formwidth ; private int formheight ; private string ConfigPathname = Application.ExecutablePath + ".Settings"; private System.Windows.Forms.TextBox txtWidth; private System.Windows.Forms.TextBox txtHeight; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public RegistrySettings() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.txtWidth = new System.Windows.Forms.TextBox(); this.txtHeight = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // txtWidth // this.txtWidth.Location = new System.Drawing.Point(136, 40); this.txtWidth.Name = "txtWidth"; this.txtWidth.TabIndex = 2; this.txtWidth.Text = ""; // // txtHeight // this.txtHeight.Location = new System.Drawing.Point(136, 72); this.txtHeight.Name = "txtHeight"; this.txtHeight.TabIndex = 3; this.txtHeight.Text = ""; // // label1 // this.label1.Location = new System.Drawing.Point(16, 40); this.label1.Name = "label1"; this.label1.TabIndex = 4; this.label1.Text = "Current Width"; // // label2 // this.label2.Location = new System.Drawing.Point(16, 72); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(104, 23); this.label2.TabIndex = 5; this.label2.Text = "Current Height"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(716, 610); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.txtHeight); this.Controls.Add(this.txtWidth); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; this.Text = "Form1"; this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing); this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged); this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// //[STAThread] //static void Main() //{ // Application.Run(new RegistrySettings()); //} private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //Xml Method /* formwidth = this.Width; formheight = this.Height; Settings xDS = new Settings(); Settings.MainRow xRow = xDS.Main.NewMainRow(); xRow.width = formwidth; xRow.height = formheight; xRow.username = "Anshu"; xDS.Clear(); xDS.Main.AddMainRow(xRow); xDS.WriteXml(ConfigPathname, System.Data.XmlWriteMode.IgnoreSchema); */ //Registry Method RegistryKey regKey = Registry.CurrentUser.CreateSubKey("Simon"); formwidth = this.Width; formheight = this.Height; regKey.SetValue("width", formwidth); regKey.SetValue("height",formheight); } private void Form1_Load(object sender, System.EventArgs e) { //Xml Method /* if (new FileInfo(ConfigPathname).Exists) { Settings xDS = new Settings(); xDS.ReadXml(ConfigPathname, System.Data.XmlReadMode.IgnoreSchema); if (xDS.Main.Rows.Count > 0) { Settings.MainRow xRow = xDS.Main[0]; if (!xRow.IswidthNull()) { if(!xRow.IsusernameNull() && xRow.username == "Anshu" ) { txtWidth.Text = xRow.width.ToString(); txtHeight.Text = xRow.height.ToString(); this.Width = xRow.width; this.Height = xRow.height; } } } else { this.Width = 724; this.Height = 644; } } */ // Opens the subkey called myApplication. RegistryKey regKey = Registry.CurrentUser.OpenSubKey("Simon"); if (regKey == null) { this.Width = 754; this.Height = 644; } else { // Reads the subkey value for myValue from the registy // key HKEY_CURRENT_USER/Simon. this.Width = Convert.ToInt32(regKey.GetValue("width")); this.Height = Convert.ToInt32(regKey.GetValue("height")); // MessageBox.Show(regKey.GetValue("width").ToString() + " " + regKey.GetValue("height").ToString(), "Registry SubKey Value", // MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void Form1_SizeChanged(object sender, System.EventArgs e) { txtWidth.Text = this.Width.ToString(); txtHeight.Text = this.Height.ToString(); } } }