![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Expert Programmer
|
No Object Instance?
I just had a lot of help with this. This is the MOST IRRITATING thign i have ever done (Move from C++ to C#). My prog compiles fine but crashes at runtime when user hits the enter Key.
Declaration on Form: [PHP] DIRCClient dircClient=new DIRCClient(); [/PHP] Overloaded Form Constructor: [PHP] public frmStatus(DIRCClient DircClient) { InitializeComponent(); dircClient=DircClient; } [/PHP] Function Using Passed Object: [PHP] private void txtStatusInput_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if(e.KeyCode==Keys.Enter) //was enter pressed? { if(!dircClient.b_conStatus) { txtStatusWin.Text+=dircClient.s_msgErrSymbol+" not connected"+'\n'; } else { txtStatusWin.Text+=txtStatusInput.Text+'\n'; txtStatusInput.Text=""; //clear the input box } } } [/PHP] ERROR: [PHP] An unhandled exception of type 'System.NullReferenceException' occured Additional Info: Object reference not set to an instance of an object [/PHP] this makes no sense to me... i seem to have set it to an instance?
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#2 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
And where is the line where the form is instantiated?
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#3 |
|
Expert Programmer
|
/me shoots himself in the head - thanks a ton Dameon, thats all you had to say. Do you mind if i put your name is my title as so?
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#4 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
A cult, aye? Fair enough.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#5 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
in c++, i would do: int x[3][3]; //declares a 3x3 array int[][] x; It wasn't until i took a class in C# that i figured out how to declare a rectangular array int[,] x = new int[3,3]; |
|
|
|
|
|
|
#6 |
|
Expert Programmer
|
What does the comma stand for? Yea I'm completely self taught through trial/error in VB && C++. But i found this forum and made a bad habit of asking for help on every little thing that doesn't work (that i normally do in cpp).
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#7 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
It is saying a 3x3 array of ints rather than an array of 3 arrays of 3 ints.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#8 |
|
Expert Programmer
|
hmmm i understand:
[PHP] int[3,3]; [/PHP] this comma i don't understand: [PHP] int[,] [/PHP] or is that just stating that you are creating a 2 dimensional array?
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#9 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#10 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Perhaps you should read the last link in your own sig?
![]()
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|