Click here to Skip to main content
15,910,083 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionRe: Error with 'System.NullReferenceException' Pin
Newbie0017-Feb-07 10:07
Newbie0017-Feb-07 10:07 
AnswerRe: Error with 'System.NullReferenceException' Pin
Christian Graus17-Feb-07 10:08
protectorChristian Graus17-Feb-07 10:08 
GeneralRe: Error with 'System.NullReferenceException' Pin
thesad17-Feb-07 12:16
thesad17-Feb-07 12:16 
AnswerRe: Error with 'System.NullReferenceException' Pin
prasad_som17-Feb-07 15:44
prasad_som17-Feb-07 15:44 
GeneralRe: Error with 'System.NullReferenceException' Pin
thesad17-Feb-07 21:44
thesad17-Feb-07 21:44 
AnswerRe: Error with 'System.NullReferenceException' Pin
prasad_som18-Feb-07 1:22
prasad_som18-Feb-07 1:22 
GeneralRe: Error with 'System.NullReferenceException' Pin
thesad18-Feb-07 2:05
thesad18-Feb-07 2:05 
AnswerRe: Error with 'System.NullReferenceException' Pin
prasad_som18-Feb-07 4:20
prasad_som18-Feb-07 4:20 
Here, you had made couple of mistakes,

thesad wrote:
array^ em = gcnew array(10);
array^ b_em = gcnew array(10);


Here, again you are defining local variables. It should be like this,
this->em = gcnew array<tank^>(10);
this->b_em = gcnew array<tank^>(10);


Again, simply defining array doesn't initializes its members, you need to allocate tank variable for each index. So, your code can be modified like this,


thesad wrote:
for(int i=0; i <10; i++){
this->em[i]->pct = gcnew System::Windows::Forms::PictureBox();
this->em[i]->pct->Location = System::Drawing::Point(250, 250);

Modify this to,

for(int i=0; i <10; i++){
em[i] = gcnew tank;//create tank object for each index
this->em[i]->pct = gcnew System::Windows::Forms::PictureBox();
this->em[i]->pct->Location = System::Drawing::Point(250, 250);
//your code follows



GeneralRe: Error with 'System.NullReferenceException' [modified] Pin
thesad18-Feb-07 4:48
thesad18-Feb-07 4:48 
GeneralRe: Error with 'System.NullReferenceException' Pin
Christian Graus18-Feb-07 9:11
protectorChristian Graus18-Feb-07 9:11 
GeneralRe: Error with 'System.NullReferenceException' Pin
prasad_som19-Feb-07 3:11
prasad_som19-Feb-07 3:11 
QuestionXp style problem in Visual Studio 2005 Pin
Vinod Moorkkan16-Feb-07 17:54
Vinod Moorkkan16-Feb-07 17:54 
AnswerRe: Xp style problem in Visual Studio 2005 Pin
Bartosz Bien20-Feb-07 20:51
Bartosz Bien20-Feb-07 20:51 
QuestionSerial Port - Remote Control Pin
frozenice16-Feb-07 11:24
frozenice16-Feb-07 11:24 
Questionproblem with Random Pin
thesad15-Feb-07 7:46
thesad15-Feb-07 7:46 
AnswerRe: problem with Random Pin
Christian Graus15-Feb-07 8:14
protectorChristian Graus15-Feb-07 8:14 
GeneralRe: problem with Random Pin
thesad15-Feb-07 8:28
thesad15-Feb-07 8:28 
QuestionEmail Messages Pin
Programm3r15-Feb-07 2:23
Programm3r15-Feb-07 2:23 
QuestionRe: Email Messages Pin
prasad_som15-Feb-07 2:39
prasad_som15-Feb-07 2:39 
QuestionRe: Email Messages Pin
Programm3r15-Feb-07 21:03
Programm3r15-Feb-07 21:03 
QuestionRe: Email Messages Pin
prasad_som15-Feb-07 21:40
prasad_som15-Feb-07 21:40 
AnswerRe: Email Messages Pin
ThatsAlok21-Feb-07 6:20
ThatsAlok21-Feb-07 6:20 
Questioncapture s-video from my pinnacle pci card to borland c++ Pin
bozzim14-Feb-07 22:40
bozzim14-Feb-07 22:40 
AnswerRe: capture s-video from my pinnacle pci card to borland c++ Pin
Christian Graus15-Feb-07 0:15
protectorChristian Graus15-Feb-07 0:15 
QuestionFileLength Pin
Vichitram14-Feb-07 20:37
Vichitram14-Feb-07 20: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.