Click here to Skip to main content
15,910,123 members
Home / Discussions / C#
   

C#

 
AnswerMissed XML Part Pin
Anonymous4-Aug-05 4:13
Anonymous4-Aug-05 4:13 
GeneralRe: Missed XML Part Pin
Kevin McFarlane4-Aug-05 4:48
Kevin McFarlane4-Aug-05 4:48 
GeneralDataView.Sort not working Pin
livez4-Aug-05 3:21
livez4-Aug-05 3:21 
GeneralRe: DataView.Sort not working Pin
Alomgir Miah4-Aug-05 4:05
Alomgir Miah4-Aug-05 4:05 
GeneralRe: DataView.Sort not working Pin
livez4-Aug-05 4:13
livez4-Aug-05 4:13 
GeneralRe: DataView.Sort not working Pin
Alomgir Miah4-Aug-05 4:45
Alomgir Miah4-Aug-05 4:45 
GeneralRe: DataView.Sort not working Pin
livez4-Aug-05 4:59
livez4-Aug-05 4:59 
GeneralClass Constructor not getting called when creating array of class object Pin
Mutty4-Aug-05 3:15
Mutty4-Aug-05 3:15 
I am trying to create an array of classes however when I try to assign values to the class variables I get an error: "Object reference not set to an instance of an object"

Am I declaring my array wrong?


<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
   private System.Windows.Forms.Button btn_FillArray<br />
   ...  //other controls<br />
<br />
   MyClass[] classArray = new MyClass[5];<br />
}<br />
<br />
private void btn_FillArray_Click(object sender, System.Eventargs e)<br />
{<br />
    classArray[0].data = 5;<br />
}<br />
<br />
<br />
class MyClass<br />
{<br />
    public MyClass()<br />
    {<br />
        data = 1;<br />
    }<br />
<br />
    public int data;<br />
}<br />
<br />
<br />


Thank you for the help - mutty
GeneralRe: Class Constructor not getting called when creating array of class object Pin
Sean Michael Murphy4-Aug-05 3:32
Sean Michael Murphy4-Aug-05 3:32 
GeneralRe: Class Constructor not getting called when creating array of class object Pin
Mutty4-Aug-05 4:45
Mutty4-Aug-05 4:45 
Generalcreate a relation betwn 2 tables in a dataset Pin
dhol4-Aug-05 3:12
dhol4-Aug-05 3:12 
GeneralRe: create a relation betwn 2 tables in a dataset Pin
Alomgir Miah4-Aug-05 3:55
Alomgir Miah4-Aug-05 3:55 
GeneralRe: create a relation betwn 2 tables in a dataset Pin
dhol5-Aug-05 2:44
dhol5-Aug-05 2:44 
GeneralSQL server 2k Database connection from ASP.NET Pin
Neel074-Aug-05 2:57
Neel074-Aug-05 2:57 
AnswerRe: SQL server 2k Database connection from ASP.NET Pin
Michael P Butler4-Aug-05 3:43
Michael P Butler4-Aug-05 3:43 
GeneralControl collection Pin
magnifique4-Aug-05 1:44
magnifique4-Aug-05 1:44 
GeneralRe: Control collection Pin
Roger Stewart4-Aug-05 3:45
professionalRoger Stewart4-Aug-05 3:45 
GeneralRe: Control collection Pin
magnifique5-Aug-05 0:16
magnifique5-Aug-05 0:16 
Generali need to ask u some questions to get started in doing a database Pin
nidhelp4-Aug-05 0:52
nidhelp4-Aug-05 0:52 
GeneralRe: i need to ask u some questions to get started in doing a database Pin
magnifique4-Aug-05 1:42
magnifique4-Aug-05 1:42 
GeneralRe: i need to ask u some questions to get started in doing a database Pin
nidhelp4-Aug-05 14:52
nidhelp4-Aug-05 14:52 
GeneralLogging Window Pin
Verio6664-Aug-05 0:33
sussVerio6664-Aug-05 0:33 
QuestionHow to delete row in datagrid/datatable with a delete button Pin
Atlemann4-Aug-05 0:30
Atlemann4-Aug-05 0:30 
AnswerRe: How to delete row in datagrid/datatable with a delete button Pin
deep74-Aug-05 0:48
deep74-Aug-05 0:48 
GeneralRe: How to delete row in datagrid/datatable with a delete button Pin
Atlemann4-Aug-05 3:06
Atlemann4-Aug-05 3:06 

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.