Click here to Skip to main content
15,897,968 members
Home / Discussions / C#
   

C#

 
GeneralRe: ScrollBars of MDI Parent Form Pin
Stephane Rodriguez.19-Jan-03 6:18
Stephane Rodriguez.19-Jan-03 6:18 
GeneralRe: ScrollBars of MDI Parent Form Pin
Nigel H. Lin19-Jan-03 6:39
Nigel H. Lin19-Jan-03 6:39 
GeneralRe: ScrollBars of MDI Parent Form Pin
Stephane Rodriguez.19-Jan-03 6:44
Stephane Rodriguez.19-Jan-03 6:44 
GeneralRe: ScrollBars of MDI Parent Form Pin
Nigel H. Lin19-Jan-03 15:41
Nigel H. Lin19-Jan-03 15:41 
GeneralRe: ScrollBars of MDI Parent Form Pin
Stephane Rodriguez.19-Jan-03 18:42
Stephane Rodriguez.19-Jan-03 18:42 
GeneralGlobal Variables Pin
Jassim Rahma18-Jan-03 2:27
Jassim Rahma18-Jan-03 2:27 
GeneralRe: Global Variables Pin
Stephane Rodriguez.18-Jan-03 3:07
Stephane Rodriguez.18-Jan-03 3:07 
GeneralArray of objects Pin
lbh18-Jan-03 2:25
lbh18-Jan-03 2:25 
I'm new to C#, and can't understand what's wrong here. I'm trying to create an array of objects, but I get this error:
"Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object."
at tht line "b[i] = new FirstClass();"
Can anyone tell me what I'm doing wrong?
Thanks in advance.
Len

public class FirstClass
{
public int a = 0;
public FirstClass()
{
}
}

public class SecondClass
{
public FirstClass[] b;
public SecondClass()
{
for (int i=0; i<16; i++)
{
b[i] = new FirstClass();
}
}
}

....
static void Main()
{
SecondClass c = new SecondClass();
....
Confused | :confused:
GeneralRe: Array of objects Pin
Stephane Rodriguez.18-Jan-03 3:04
Stephane Rodriguez.18-Jan-03 3:04 
GeneralSocket Question Pin
gekoscan17-Jan-03 21:29
gekoscan17-Jan-03 21:29 
GeneralRe: Socket Question Pin
Stephane Rodriguez.17-Jan-03 21:48
Stephane Rodriguez.17-Jan-03 21:48 
GeneralRe: Socket Question Pin
gekoscan18-Jan-03 21:42
gekoscan18-Jan-03 21:42 
GeneralRe: Socket Question Pin
stephen woolhead18-Jan-03 1:40
stephen woolhead18-Jan-03 1:40 
GeneralCreating client/server chat program Pin
jtmtv1817-Jan-03 20:41
jtmtv1817-Jan-03 20:41 
GeneralRe: Creating client/server chat program Pin
leppie17-Jan-03 21:05
leppie17-Jan-03 21:05 
GeneralRe: Creating client/server chat program Pin
jtmtv1817-Jan-03 21:33
jtmtv1817-Jan-03 21:33 
GeneralRe: Creating client/server chat program Pin
Stephane Rodriguez.17-Jan-03 21:52
Stephane Rodriguez.17-Jan-03 21:52 
Generalmethod variable scope problem Pin
vlusardi17-Jan-03 10:19
vlusardi17-Jan-03 10:19 
GeneralRe: method variable scope problem Pin
Stephane Rodriguez.17-Jan-03 10:54
Stephane Rodriguez.17-Jan-03 10:54 
GeneralRe: method variable scope problem Pin
vlusardi17-Jan-03 11:01
vlusardi17-Jan-03 11:01 
GeneralRe: method variable scope problem Pin
vlusardi17-Jan-03 11:44
vlusardi17-Jan-03 11:44 
GeneralSerialization Question Pin
gekoscan17-Jan-03 9:52
gekoscan17-Jan-03 9:52 
GeneralRe: Serialization Question Pin
Stephane Rodriguez.17-Jan-03 10:36
Stephane Rodriguez.17-Jan-03 10:36 
GeneralCreating and using a Dll in Dev-C++ Pin
Aidman17-Jan-03 8:37
Aidman17-Jan-03 8:37 
GeneralRe: Creating and using a Dll in Dev-C++ Pin
Stephane Rodriguez.17-Jan-03 8:44
Stephane Rodriguez.17-Jan-03 8:44 

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.