hi all,
line which gives overflow exception unhandled is binaryValue[i] = Convert.ToByte(editBox.Text));Code:private void FocusOver(object sender, System.EventArgs e) { this.lvItem.SubItems[2].Text = editBox.Text; //Insert into registry [IMPORTANT] ListViewItem selectedItem = this.lvFiles.SelectedItems[0]; string nodeFullPath = ""; string keyName = selectedItem.Text.ToString(); nodeFullPath = nodePath(this.tvFolders.SelectedNode.FullPath.ToString()); if (this.lvItem.SubItems[1].Text == "STRING") { ManagedRegistry.Delete(nodeFullPath, selectedItem.Text); ManagedRegistry.WriteKeyString(nodeFullPath, keyName, editBox.Text); } if (this.lvItem.SubItems[1].Text == "INTEGER") { int intValue = 0; intValue = (int)Convert.ToInt32(editBox.Text); ManagedRegistry.Delete(nodeFullPath, selectedItem.Text); ManagedRegistry.WriteKeyInteger(nodeFullPath, keyName, intValue); } if (this.lvItem.SubItems[1].Text == "BINARY") { byte[] binaryValue = new byte[10]; for(int i = 0 ; i <10 ; i++) { binaryValue[i] = Convert.ToByte(editBox.Text)); } ManagedRegistry.Delete(nodeFullPath, selectedItem.Text); ManagedRegistry.WriteKeyBinary(nodeFullPath, keyName, binaryValue); } InitListView(this.tvFolders.SelectedNode); EnumerateHBRegNode(this.tvFolders.SelectedNode); this.lvFiles.Refresh(); editBox.Hide(); }
wen i built it and run in MSC#2008 express edition, it shows following error. Also it says cannot implicity convert 'int'. use explicit (did u miss casting?)
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Registry.RegMainWin.subMenuModify_Click(Object sender, EventArgs e) in C:\Documents and Settings\leo\Desktop\RegEdit\RegEdit.cs:line 2216
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItem.MenuItemData.Execute ()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Command.DispatchID(Int32 id)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ListView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
PLS help me with an optimal solution, as am new to c# programming.



LinkBack URL
About LinkBacks


