Click here to Skip to main content
15,896,727 members
Home / Discussions / C#
   

C#

 
Questionauto update Pin
Member 59031020-Apr-10 19:53
Member 59031020-Apr-10 19:53 
AnswerRe: auto update Pin
Calla20-Apr-10 20:18
Calla20-Apr-10 20:18 
QuestionHow get USP device serial no Pin
anishkannan20-Apr-10 19:50
anishkannan20-Apr-10 19:50 
AnswerRe: How get USP device serial no Pin
sanforjackass20-Apr-10 21:52
sanforjackass20-Apr-10 21:52 
AnswerRe: How get USP device serial no Pin
Kythen21-Apr-10 6:18
Kythen21-Apr-10 6:18 
QuestionWaitOne won't wakeup Pin
doubleclick2d20-Apr-10 14:58
doubleclick2d20-Apr-10 14:58 
AnswerRe: WaitOne won't wakeup Pin
Luc Pattyn20-Apr-10 15:41
sitebuilderLuc Pattyn20-Apr-10 15:41 
Questionunresolved hashtable problem [modified] Pin
Jassim Rahma20-Apr-10 12:55
Jassim Rahma20-Apr-10 12:55 
I a trying to have a hashtable class to populate all the variables from my database to be saved and used in my application as public variables.

this is my public class

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace cure_hospital_management
{
    class public_class
    {
        public Hashtable _sysem_parameters_hash;

        public void get_system_parameters()
        {
            _sysem_parameters_hash = new Hashtable();
            _sysem_parameters_hash.Add("Name", "Jassim Rahma");
        }
    }
}



In my MainFom_Load I am calling:

public_var.get_system_parameters();
public_var._sysem_parameters_hash.Add("Age", "36");



then I am trying to read the hashtable value like this:

MessageBox.Show(public_var._sysem_parameters_hash("Name").ToString());


but getting this error on the reading line (the MessageBox):

System.NullReferenceException was unhandled by user code<br />
  Message="Object reference not set to an instance of an object."<br />
  Source="cure"<br />
  StackTrace:<br />
       at cure_hospital_management.frmDoctorDashboard.frmDoctorDashboard_Load(Object sender, EventArgs e) in C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\doctor_dashboard.cs:line 2050<br />
       at System.EventHandler.Invoke(Object sender, EventArgs e)<br />
       at System.Windows.Forms.Form.OnLoad(EventArgs e)<br />
       at System.Windows.Forms.Form.OnCreateControl()<br />
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)<br />
       at System.Windows.Forms.Control.CreateControl()<br />
       at System.Windows.Forms.Control.WmShowWindow(Message&amp; m)<br />
       at System.Windows.Forms.Control.WndProc(Message&amp; m)<br />
       at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)<br />
       at System.Windows.Forms.ContainerControl.WndProc(Message&amp; m)<br />
       at System.Windows.Forms.Form.WmShowWindow(Message&amp; m)<br />
       at System.Windows.Forms.Form.WndProc(Message&amp; m)<br />
       at DevExpress.XtraEditors.XtraForm.WndProc(Message&amp; msg)<br />
       at cure_hospital_management.frmDoctorDashboard.WndProc(Message&amp; m) in C:\Users\Jassim\Documents\Visual Studio 2008\Projects\Cure\Cure\doctor_dashboard.cs:line 84<br />
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)<br />
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)<br />
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)<br />
       at DevExpress.Utils.Win.Hook.ControlWndHook.CallWindowProc(IntPtr pPrevProc, IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam)<br />
       at DevExpress.Utils.Win.Hook.ControlWndHook.WindowProc(IntPtr hWnd, Int32 message, IntPtr wParam, IntPtr lParam)<br />
       at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)<br />
       at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)<br />
       at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)<br />
  InnerException:


-- Modified Tuesday, April 20, 2010 7:01 PM

AnswerRe: unresolved hashtable problem Pin
Luc Pattyn20-Apr-10 14:10
sitebuilderLuc Pattyn20-Apr-10 14:10 
AnswerRe: unresolved hashtable problem Pin
Som Shekhar20-Apr-10 18:18
Som Shekhar20-Apr-10 18:18 
GeneralRe: unresolved hashtable problem Pin
Jassim Rahma24-Apr-10 23:48
Jassim Rahma24-Apr-10 23:48 
GeneralRe: unresolved hashtable problem Pin
Som Shekhar24-Apr-10 23:56
Som Shekhar24-Apr-10 23:56 
GeneralRe: unresolved hashtable problem Pin
Jassim Rahma25-Apr-10 0:06
Jassim Rahma25-Apr-10 0:06 
GeneralRe: unresolved hashtable problem Pin
Som Shekhar25-Apr-10 0:17
Som Shekhar25-Apr-10 0:17 
GeneralRe: unresolved hashtable problem Pin
Jassim Rahma25-Apr-10 0:23
Jassim Rahma25-Apr-10 0:23 
GeneralRe: unresolved hashtable problem Pin
Som Shekhar25-Apr-10 0:33
Som Shekhar25-Apr-10 0:33 
GeneralRe: unresolved hashtable problem Pin
Jassim Rahma25-Apr-10 1:14
Jassim Rahma25-Apr-10 1:14 
GeneralRe: unresolved hashtable problem Pin
Som Shekhar25-Apr-10 1:25
Som Shekhar25-Apr-10 1:25 
GeneralRe: unresolved hashtable problem [modified] Pin
Jassim Rahma26-Apr-10 3:48
Jassim Rahma26-Apr-10 3:48 
GeneralRe: unresolved hashtable problem Pin
Som Shekhar26-Apr-10 3:54
Som Shekhar26-Apr-10 3:54 
GeneralRe: unresolved hashtable problem Pin
Jassim Rahma26-Apr-10 12:35
Jassim Rahma26-Apr-10 12:35 
GeneralRe: unresolved hashtable problem Pin
Som Shekhar26-Apr-10 17:41
Som Shekhar26-Apr-10 17:41 
QuestionVariable of type Pin
jabbawok20-Apr-10 10:18
jabbawok20-Apr-10 10:18 
AnswerRe: Variable of type Pin
Anthony Mushrow20-Apr-10 10:31
professionalAnthony Mushrow20-Apr-10 10:31 
GeneralRe: Variable of type Pin
jabbawok20-Apr-10 10:37
jabbawok20-Apr-10 10:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.