Click to See Complete Forum and Search --> : Please help!!!


AndyK
December 8th, 1999, 12:38 AM
I have a program and when I run it, splash screen shows up but when it get's to a program itself, then my VB just freezes up so I have no choice but to use Ctrl+Alt+Del to shut the Vb down......
Anyone know how can I trace out that error because VB doesn't show me what is wrong....
I use few API calls like GetWindowsDirectory, GetPrivateProfileString (read from INI), SetWindowPos, etc. in my Form_Load() Sub , also it loads few pictures, sets few strings into text boxes, activates timers, etc....not difficult stuff, but I really need to find out what is wrong with my program, so if anyone have any advice that he/she can give me about "unknown" errors then please reply

Thank You

Lothar Haensler
December 8th, 1999, 01:57 AM
just an idea:
I have seen some programs that "lock up" when they display a splash screen.
The reason was: there was a MessageBox behind (e.g. because of a vb runtime error) the splash screen that you could not see.
Sometimes the splash screen is a top-level window (setWindowPos...HWND_TOPMOST...).

AndyK
December 8th, 1999, 03:53 PM
:), Thanks for replying but i know that sometimes msgbox pop-up behind the form.....but my problem is not that, after splash screen unload it self and starts form1 with form1.show, then I get "lock up".......so i don't really know what is wrong....:(

Ravi Kiran
December 9th, 1999, 04:47 AM
The way you described gives an impression that a lot is happening in the form load.
To reduce the load in the form_load (pun intended* ), some times i do this.. just to give an impression that things are happing faster. Do some min stuff, like position determination etc in the form load. the rest you deligate into a timer event, which would be started in the last line of form load.

Then in the timer event, do rest of the stuff and set the timer off. I typically call this "background processing". Like setting the tb values etc can be done in this.
If the timer interval is you will not notice the diff. but for this you shoudl write some robust code with good error checking.

Some times i use Form_Activate also with a static var, to intialise classes, data etc.

Another thing: If you set the positions of controls in form_load, it automatically trigers form_resize, Take care of that, if you are doing anything special in form resize. To avoid recursive calls try a static variable, in _resize

I would also check the code in text_change , listbox_click events to check they are robust. Something non-robust in those should actually give you a "Out of stack space error".

I would even run a test w/o slash screen just to be sure!

If you really want a good debuggin style put Debug.Prints every where, you will atleast know till which point the program went thru.. dont put break points.

I often forget this:
Check in "for next" loops, if you are incrementing the loop variable or not. If you are loding data from a DB make sure you have a recordset.MoveNext inside the while/DO loops ( same thing as above!!)

Thats it.. it all else fail.. pray to God.

RK

AndyK
December 10th, 1999, 03:10 PM
Hey thanks!! Those ideas about do-loop gave me a reason to check all my do-for-while functions and guess what!!!...I have picture scrolling in do until-loop function and I haven't set the pic1.left to be = x when x = pic1.left and x = x + 1 (which supposed to move from left to the center). Simple code but it can freeze whole project!!!! Thanks for replying everyone!!!

pavan_raut
December 17th, 1999, 08:06 AM
I think that you should just write
frmSplash.refresh after frmSplash.show to show the form
if it works fine or else sorry to disturb you