|
Thanks for the idea, Dave. Of course, option a is easier - still I like option b better . Actually I want to collect the files automatically while the user sets other options for their processing.
By now, I anyway use the ThreadPool to collect the filelist, but I didn't think about interrupting and re-starting the process.
|
|
|
|
|
|
Sounds like a very good idea - thank you!
|
|
|
|
|
I am wondering to make a parental control like program for Internet Explorer / Mozilla .. Thanks for the reply and help...
|
|
|
|
|
Firstly, there are plenty around already, so why reinvent the wheel... and secondly - why use VB6 for this?
|
|
|
|
|
_Damian S_ wrote: why use VB6 for this anything?
FTFY
|
|
|
|
|
I'm making a security project, but this is the last problem, making a parental control..
|
|
|
|
|
it is unwise to use VB6 for anything, the language is antiquated and obsolete.
|
|
|
|
|
We have just converted a large VB6 desktop app to VB.NET 2008. First via the VB 2005 (opened the project), then days of fixing errors, etc. Then opened the VB 2005 in VB 2008 so now it is a 2008 solution.
There are about 30 forms with code behind and about 40 other modules.
Message InvalidOperationException was unhandled.
... The type initializer for .... threw an error.
on
AppTest = true
App framework is enabled, it is using .net 3.5.
In a module there is
Public FormMain as frmMain = frmMain
Public AppTest as boolean = false
Public AppTest as boolean = false never gets executed but the FormMain does (as per a breakpoint).
AppTest = true in frmMain crashes with the indicated error.
This works in 6-7 other programs and has for years but crashes with indicated error
There are no errors when we do a build.
need just 1 with FormMain as a reference to frmMain.
This technique worked in many other programs but not this one. Not sure why.
|
|
|
|
|
Usually indicates that an exception occured in a constructor, this case, prolly frmMain. Doing a build only checks for compile-time errors, not for runtime errors.
QBTeKcom wrote: This technique worked in many other programs but not this one. Not sure why.
Make a list of all instructions that throw exceptions in your constructor of the mainform. You can look-em up on MSDN.
Find out
Bastard Programmer from Hell
|
|
|
|
|
Hi,
1.
Public FormMain as frmMain = frmMain is a statement I don't understand; how could one initialize a variable of some type to its type? or is there some VB idiosyncrasy I'm missing?
2.
I suggest you put a breakpoint near the start of the frmMain constructor, then single-step from there.
|
|
|
|
|
VB creates a default-instance of the form. "frmMain.Show" refers to that default instance, and will, sadly, work without creating it.
Bastard Programmer from Hell
|
|
|
|
|
Public FormMain as frmMain = frmMain
At the point this is called, is frmMain already instantiated elsewhere?
If not you will need to Public FormMain as frmMain = New frmMain
|
|
|
|
|
We have not added any code to instantiate it.
In a working program that uses the same technique.
I hit F8 to step thru.
1. It goes into some CheckChanged events on frmMain so I assume the form is instantiated.
2. It then goes into the module with Public FormMain as frmMain = frmMain where it completes the definitions ok (does the last).
3. Then it goes to frmMain's MyBase.load
4. Program runs fine
In the failing program I hit F8
1. It immediately goes to the module with Public FormMain as frmMain = frmMain
(frmMain probably NOT instantiated)
2. The module definitions do not complete (last statement executed is the FormMain).
3. It goes to other modules for defintitions
4. It now goes to the ..Changed events on frmMain (on working programs this was first).
5. It then goes to the frmMain MyBase.load
So the failing program is taking a different startup path and I do not know why.
What would cause the modules to be executed first before frmMain is instantiated?????
|
|
|
|
|
In the project properties, what is the startup form/module?
|
|
|
|
|
frmMain is the startup form on all projects include the failing one and the working ones.
|
|
|
|
|
QBTeKcom wrote: It goes into some CheckChanged events on frmMain so I assume the form is instantiated.
Wrong assumption; might fire from the constructor if it has been hooked up in the InitializeComponent -method.
Bastard Programmer from Hell
|
|
|
|
|
OK, then please tell me how I can make it work like the other programs. What do I need to change or look at or something??????
|
|
|
|
|
QBTeKcom wrote: OK, then please tell me how I can make it work like the other programs
It is already working "like" the other programs, you said that yourself:
QBTeKcom wrote: This works in 6-7 other programs and has for years but crashes with indicated error
There are no errors when we do a build.
I'm guessing that the type initializer (the constructor) for frmMain threw an exception that you did not handle. It might be in an event that gets triggered by an action in the constructor. After the InitializeComponent the form has been created, and all events that are coupled from the IDE will be firing (like TextChanged and such)
Put a breakpoint in there and verify each statement, or move all/most of the code from the constructor to a separate initialization-method that you call.
QBTeKcom wrote: This technique worked in many other programs but not this one. Not sure why.
The applications aren't identical, or they would behave identical. I'm guessing different constructors, but there "has" to be something that causes it.
QBTeKcom wrote: What would cause the modules to be executed first before frmMain is instantiated?????
Are you using the modules from the constructor of frmMain?
Bastard Programmer from Hell
|
|
|
|
|
Never said the programs were identical but that they use the same technique.
I know something must be doing it but don't know what nor how to determine which is why I am posting on the forum.
Not touching any constructor's for any forms.
|
|
|
|
|
Put Try catch around the InitiaizeComponent for frmMain and nothing was caught. I did put a break point on the Try and it stopped there but no error. I know that the module with the frmMain is failing but nothing is caught.
If I leave out the = frmMain then FormMain has a value of nothing.
|
|
|
|
|
Make it a "= New frmMain()", you don't want the default instance.
Bastard Programmer from Hell
|
|
|
|
|
Workaround found.
We took out the = frmMain from the module and moved it to frmMain itself. That seemed to solve that part. We are now debugging other VB6 conversion issues.
Not sure why the other programs worked.
|
|
|
|
|
QBTeKcom wrote: Workaround found.
We took out the = frmMain from the module and moved it to frmMain itself. That seemed to solve that part.
Well done, and thanks for posting what caused the issue
QBTeKcom wrote: We are now debugging other VB6 conversion issues.
Tedious work, but rewarding once it's done. Good luck
Bastard Programmer from Hell
|
|
|
|
|
I still would like to know why this one failed and all the others worked.
What would cause the module to be invoked before the frmMain constuctors?
Do anyone how a clue?
|
|
|
|