473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Code fails to execute - no error, and program keeps running

I have an extremely vexing problem occurring in a program that I am writing.
Consider the following block of code:

Dim pDancer As New BEDancer
mintIndex = mintIndex + 1
pDancer.DancerName = "Dancer #" & mintIndex
pDancer.DancerStatus = BEDancerStatus.BE_AVAILABLE
pDancer.CardID = mintIndex
oBEDancerList.AddDancer(pDancer)

....where BEDancer is a user defined class in a referenced class library,
mintIndex is a class level variable, and oBEDancerList is a user control
defined in a referenced control library.

When I place this code (and only this code) into the event handler for the
click event of a button on a form, it executes flawlessly - the BEDancer
gets added to the BEDancerList control without any complications.
HOWEVER...

When I place this code (and only this code) into the event handler for the
"CardInserted" event in a user defined class (which is instantiated in the
code for the form), the code executes up to the line "pDancer.CardID =
mintIndex" and NO FURTHER. Beyond that, the code simply STOPS EXECUTING.
If I place additional code after the AddDancer method, it doesn't execute.
No errors are thrown - it just stops. If I comment out the
"oBEDancerList.AddDancer(pDancer)" line, code past it will execute just
fine.

Why would this block of code work fine for a click event but not for the
event raised by my custom class? The custom class does not reference the
BEDancerList control library in any way. It uses the BEDancer class from a
shared class library. In fact, the files look like this:

BEGlobals.dll <- location of BEDancer
BEControls.dll <- location of BEDancerList control
BELib.dll <- location of the class which raises the "CardInserted" event
BEDJApp.exe <- main app that is running it all

The latter three files all reference BEGlobals.dll, if that matters.

Finally, I can still access the oBEDancerList control from the
"CardInserted" event handler. I can display the oBEDancerList.DancerCount
property or even call the oBEDancerList.RemoveDancer method. I just can't
AddDancer! Very, very troublesome indeed.

In case you want to see this, the AddDancer code looks like this:

Dim pDancerBox As BEDancerBox
pDancerBox = New BEDancerBox(Dancer)
AddHandler pDancerBox.Clicked, AddressOf DancerBoxClicked
AddHandler pDancerBox.StatusChanged, AddressOf StatusChanged
pnlDancerList.Controls.Add(pDancerBox)
Reorder(pnlDancerList.Controls.Count - 1)

I tried commenting out the AddHandler lines in case something funky was
going on there, but that didn't make any difference. As you may be able to
tell from this code, the AddDancer method is adding BEDancerBox controls
into a panel control.

Any thoughts?

(Oh yeah - as you may be able to tell, this is an application for a... uh...
"gentlemen's club." If you can help - and are local - I can probably hook
you up with a free couch dance! LOL! ;-))
Nov 20 '05 #1
9 1474
Hi BoloBaby,

My first thought is, that you say that it stops on the
pDancer.DancerName = "Dancer #" & mintIndex


So what is this (I asume) property

And your offer I have no intrest at all, I am grown up in an area of the
world where that is mostly for the tourists.

:-)

Cor
Nov 20 '05 #2
That property is simply a string that stores the dancer name. (Later it
will be filled from a database, but for now I'm just putting a pseudo-value
in there.)

This property has no special processing in the Get and Set statements. Just
value assignment to a string variable.

This line of code works flawlessly when it is called from the button's click
handler. Also, that is the last line of code to execute. In other words,
it actually performs that line of code without any problems. It is the NEXT
line of code that fails to execute.

What really bothers me here is that the code simply fails to execute. It
doesn't throw an error or cause a runtime error - it just stops executing.
The program still runs, but if I try to raise that event again, it fails to
execute at the same exact line... a line of code that works just fine from a
button's click handler. It just doesn't make any sense...
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
Hi BoloBaby,

My first thought is, that you say that it stops on the
pDancer.DancerName = "Dancer #" & mintIndex


So what is this (I asume) property

And your offer I have no intrest at all, I am grown up in an area of the
world where that is mostly for the tourists.

:-)

Cor

Nov 20 '05 #3
I've actually traced the code down to the exact line it fails. This occurs
when attempting to add a custom control to a panel control during the
AddDancer method.

Is the panel control bugged? Is this a known issue?
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uG*************@TK2MSFTNGP11.phx.gbl...
Hi BoloBaby,

My first thought is, that you say that it stops on the
pDancer.DancerName = "Dancer #" & mintIndex


So what is this (I asume) property

And your offer I have no intrest at all, I am grown up in an area of the
world where that is mostly for the tourists.

:-)

Cor

Nov 20 '05 #4
Hi BoloBaby,

What is than in that next line, I really though from you text that it
stopped in the line you said,

BEDancerStatus.BE_AVAILABLE

What is that?

Cor
Nov 20 '05 #5
The code fails to execute during this line -
"oBEDancerList.AddDancer(pDancer)"

I traced the execution into that method. The code within that method works
great up until it gets to:

"pnlDancerList.Controls.Add(pDancerBox)"

....which is when I attempt to add a "BEDancerBox" control to my panel
control. That is where it fails. It doesn't throw an error, it just stops
executing.

This must have something to do with the panel control and adding controls to
it during runtime....
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:up**************@tk2msftngp13.phx.gbl...
Hi BoloBaby,

What is than in that next line, I really though from you text that it
stopped in the line you said,

BEDancerStatus.BE_AVAILABLE

What is that?

Cor

Nov 20 '05 #6
How did you create the pDancerBox?

"pnlDancerList.Controls.Add(pDancerBox)"

...which is when I attempt to add a "BEDancerBox" control to my panel
control. That is where it fails. It doesn't throw an error, it just stops executing.

This must have something to do with the panel control and adding controls to it during runtime....

Nov 20 '05 #7
>
Is the panel control bugged? Is this a known issue?

Never seen one thing about a panel here

Cor
Nov 20 '05 #8
Cor,

I distilled the code down to a really simply skeletal version of the code.
I don't use any custom controls or anything - just a form, a button, a panel
control, and my custom event.

I posted a new question under the title "Bug in .NET panel control? Or am I
missing something?"

I felt that the issue was probably getting confused by my use of custom
classes and controls - so I cut it down to the absolute basics. Check out
that thread for a clearer picture of what is happening.

Gardner
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
How did you create the pDancerBox?

"pnlDancerList.Controls.Add(pDancerBox)"

...which is when I attempt to add a "BEDancerBox" control to my panel
control. That is where it fails. It doesn't throw an error, it just stops
executing.

This must have something to do with the panel control and adding

controls to
it during runtime....


Nov 20 '05 #9
I posted complete source code for the streamlined app under that alternate
thread. It is very short, but demonstrates that something strange is
happening....
Nov 20 '05 #10

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

Similar topics

2
by: J Dubal | last post by:
Hello good people, Following works in FC1 (python-2.2.3-7, postgresql-7.3.4-11, kernel-2.4.22-1.2194.nptl, pyPgSQL-2.4) from pyPgSQL import PgSQL conn =...
5
by: Dave | last post by:
I reinstalled SQL 2000 server after reformatting my drive. Now I cannot open a database in my C## program as before. If I use "Provider=SQLOLEDB;Data Source=localhost; Initial...
2
by: Greg Strong | last post by:
Hello All, I've written code in a test database with test data. Everything seems to be working except compact database in VB code per http://www.mvps.org/access/general/gen0041.htm. The reason I...
25
by: H.A. Sujith | last post by:
If malloc fails what should I do? 1. Exit imediately. 2. Print an error message (or put a log entry) and exit. 3. Print an error message (or put a log entry) and continue execution (after...
8
by: koorb | last post by:
I am starting a program from a module with the Sub main procedure and I want it to display two forms for the program's interface, but when I run the program both forms just open and then program...
5
by: Blasting Cap | last post by:
I have a VB6 program that runs as an app, that I want to both convert it to vb.net, and run it as a service on the server. I have been able to create the service, and what I did was to open the...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
10
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET...
4
by: =?Utf-8?B?dmlwZXJ4MTk2Nw==?= | last post by:
We are having an issue with an application we are developing. We have a Legacy COM DLL in C++ that we have converted to Visual Studio 2008. This COM DLL has methods that are calling Managed C#...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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 projectplanning, coding, testing,...
0
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...

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.