Click here to Skip to main content
15,913,587 members
Home / Discussions / C#
   

C#

 
GeneralRe: Do events?? (C# Newbi) Pin
Dwayner7928-Jan-05 9:43
Dwayner7928-Jan-05 9:43 
GeneralRe: Do events?? (C# Newbi) Pin
Skynyrd28-Jan-05 9:54
Skynyrd28-Jan-05 9:54 
GeneralRe: Do events?? (C# Newbi) Pin
Dwayner7928-Jan-05 10:26
Dwayner7928-Jan-05 10:26 
GeneralRe: Do events?? (C# Newbi) Pin
Skynyrd28-Jan-05 11:32
Skynyrd28-Jan-05 11:32 
GeneralRe: Do events?? (C# Newbi) Pin
therealmccoy28-Jan-05 17:56
therealmccoy28-Jan-05 17:56 
GeneralRe: Do events?? (C# Newbi) Pin
Dave Kreskowiak28-Jan-05 10:18
mveDave Kreskowiak28-Jan-05 10:18 
GeneralRe: Do events?? (C# Newbi) Pin
Dwayner7928-Jan-05 10:34
Dwayner7928-Jan-05 10:34 
Generalpassing data from one form to another Pin
steve_rm28-Jan-05 4:06
steve_rm28-Jan-05 4:06 
Hello,

I have my mdi form. One of the child forms displays a datagrid of employee salaries.

On the mdi form l have a button called update. I want to pass the Employee ID number from the grid and display it in another form.

This is what l have done so far, but does not work.
In the salaries form (datagrid form) i have this code.

/****************************<br />
                                Set a variable and store the ID number in this value when the user clicks the grid row<br />
                                ****************************/<br />
		private string employeeNumber;<br />
		employeeNumber = grdSalaries[grdSalaries.CurrentRowIndex,0];<br />
<br />
                                /******************************************************<br />
		 *For sending this employeenumber to the update form<br />
		 * to update the correct employee details<br />
		 * ****************************************************/<br />
		public string getEmployeeNumber<br />
		{<br />
			get<br />
			{<br />
				return employeeNumber;<br />
			}<br />
			set<br />
			{<br />
				value = employeeNumber;<br />
			}<br />
		}


In the update form l have this code in the form load.
employeeNumber = parent.getEmployeeNumber;

I have declared these above the constructor
private string employeeNumber;<br />
frmSalaries parent;

My constructor is listed below

public frmUpdateEmployee(frmSalaries form)<br />
		{<br />
			//<br />
			// Required for Windows Form Designer support<br />
			//<br />
			InitializeComponent();<br />
<br />
			//<br />
			// TODO: Add any constructor code after InitializeComponent call<br />
			//<br />
			parent = form;<br />
		}


The error message is below
An unhandled exception of type 'System.NullReferenceException' occurred in payrole.exe

Additional information: Object reference not set to an instance of an object.

The way the program works is the main control buttons are displayed in the mdi, when you click on show salaries it displays the form with the grid. The user will click once on the grid and then click on the update button on the mdi form. This will then display another form which is passed the ID number so l know who i have to update.

Many thanks in advance,

Steve
GeneralRe: passing data from one form to another Pin
Bahadir Cambel28-Jan-05 11:45
Bahadir Cambel28-Jan-05 11:45 
GeneralHelp On Serialization Pin
fmarcos28-Jan-05 2:05
fmarcos28-Jan-05 2:05 
GeneralCustomize Control Pin
jzb28-Jan-05 0:04
jzb28-Jan-05 0:04 
GeneralRe: Customize Control Pin
spif200128-Jan-05 1:33
spif200128-Jan-05 1:33 
GeneralSubstring's problem Pin
jzb27-Jan-05 23:50
jzb27-Jan-05 23:50 
GeneralRe: Substring's problem Pin
mav.northwind28-Jan-05 0:01
mav.northwind28-Jan-05 0:01 
GeneralRe: Substring's problem Pin
jzb28-Jan-05 0:15
jzb28-Jan-05 0:15 
GeneralRe: Substring's problem Pin
mav.northwind28-Jan-05 0:27
mav.northwind28-Jan-05 0:27 
GeneralRe: Substring's problem Pin
Colin Angus Mackay28-Jan-05 4:33
Colin Angus Mackay28-Jan-05 4:33 
GeneralRe: Substring's problem Pin
mav.northwind28-Jan-05 4:46
mav.northwind28-Jan-05 4:46 
Generalview the incoming SOAP message Pin
weeteck27-Jan-05 22:56
weeteck27-Jan-05 22:56 
GeneralRe: view the incoming SOAP message Pin
Mazdak28-Jan-05 2:09
Mazdak28-Jan-05 2:09 
QuestionHow to let web form designer auto-generate the special code in InitializeComponent()? Pin
J Wang27-Jan-05 21:23
J Wang27-Jan-05 21:23 
QuestionHow to insert data in the middle of a stream? Pin
mav.northwind27-Jan-05 21:21
mav.northwind27-Jan-05 21:21 
AnswerRe: How to insert data in the middle of a stream? Pin
Dave Kreskowiak28-Jan-05 6:45
mveDave Kreskowiak28-Jan-05 6:45 
GeneralRe: How to insert data in the middle of a stream? Pin
mav.northwind28-Jan-05 7:36
mav.northwind28-Jan-05 7:36 
GeneralDLL Injection in C# Pin
Budi Zhu27-Jan-05 21:17
Budi Zhu27-Jan-05 21:17 

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.