473,467 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form.ActiveForm.Handle exceptoin

Why is it that when I am debugging an application that has a call to
Form.ActiveForm, if I set a breakpoint before the call then when I reach
that statement a NullReferenceException is thrown, but if the breakpoint was
set following the call to Form.ActiveForm, then I can continue the debug
session without a problem?

Thanks,

Dennis
Nov 16 '05 #1
2 2030
Dennis,

Probably because it tries to get a form from the active window handle.
If the current window is the debug window, then it doesn't have a managed
window to map to =)

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dennis C. Drumm" <an*********@community.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Why is it that when I am debugging an application that has a call to
Form.ActiveForm, if I set a breakpoint before the call then when I reach
that statement a NullReferenceException is thrown, but if the breakpoint
was set following the call to Form.ActiveForm, then I can continue the
debug session without a problem?

Thanks,

Dennis

Nov 16 '05 #2
Nicholas:

I thought it might be something like that, I just wasn't sure whether or not
the vs.net environment could compensate for that in debug mode.

Thnaks,

Dennis
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OZ*************@TK2MSFTNGP12.phx.gbl...
Dennis,

Probably because it tries to get a form from the active window handle.
If the current window is the debug window, then it doesn't have a managed
window to map to =)

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dennis C. Drumm" <an*********@community.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Why is it that when I am debugging an application that has a call to
Form.ActiveForm, if I set a breakpoint before the call then when I reach
that statement a NullReferenceException is thrown, but if the breakpoint
was set following the call to Form.ActiveForm, then I can continue the
debug session without a problem?

Thanks,

Dennis


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sherwood | last post by:
Greetings, I have the following code (which displays a second form), but it is not working as expected. I want to close the calling form after the dismissing the second form. However, the...
5
by: Ignacio X. Domínguez | last post by:
Hi. I have created a component (System.ComponentModel.Component) that I place on a form. Is there a way of obtaining the Form.Handle of the form where I have placed my component? Thank you
3
by: Eh | last post by:
I have a project containing a WindowsForm and a module and need to set the text property on a label control on the form from the module. here's the code (from MS Framework .Net Doc): Dim test...
7
by: Hugh | last post by:
Hi, I used following sentex to change form width: MainForm.ActiveForm.width = 200 However, a error was generated: An unhandled exception of type 'System.NullReferenceException' occurred. I...
3
by: ramhog | last post by:
Hello all, I have a C# control that is housed on a form that was created in VB 6. There are some activities I want to do only if the control is on the ActiveForm. However, since the form is a VB...
2
by: Jim Madsen | last post by:
OK--Beginner question-- I have a project with one form -- Form1. To change the text, why can't I use "Form1.Text = something"? Instead I have to use "Form1.ActiveForm.Text = Something". As an...
3
by: Peter Morris | last post by:
Form activeForm = System.Windows.Forms.Form.ActiveForm; Form activeMdiChildForm = activeForm.ActiveMdiChild; This code is in a component of mine and is triggered from various places within...
10
by: John Brown | last post by:
Hi there, Does anyone know how to (generically) determine the currently active form for an application using a "static" function (so I can call it from anywhere). There is no offiical way I've...
2
by: Emre Sevinc | last post by:
Hello, I have a strange situation. I create a very simple Windows Forms application and place the code below however even though I place breakpoints in various event handling points VS.NET 2005...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.