[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VB Form Freezes

Posted on 2005-05-10
17
Medium Priority
?
2,098 Views
Last Modified: 2013-11-13
I'm a beginner at VB and I was making a program and pushing through it with unfamiliar code (although I can understand it once I read it -- I'm not totally hopeless at computers ;) and suddenly, everytime I press F5, I can't press any of the controls on my form -- I can't even press the X at the top right -- it just seems frozen.

I rebooted and Ctrl-Xed away ALL the code and even tried to make it an exe file but it still is frozen no matter what I do. Any suggestions or hints?
0
Comment
Question by:Zyloch
  • 5
  • 5
  • 2
  • +5
17 Comments
 
LVL 18

Assisted Solution

by:Sethi
Sethi earned 200 total points
ID: 13974582
It may be because some of the code in Form Load event is trying to do something that is taking time or getting into infinite loop. Generally it happens :
1. When we try to open a SQL Server and the SQL is not present in the system or it is shut off.
2. When we use On Error Resume statement and the code execution falls on the same error line again and again.

and so many reasons. Check the Form Load event of this form.
0
 
LVL 11

Expert Comment

by:andrewbleakley
ID: 13974996
post you form_load, form_activate etc code, you sound like you have a hang in there as in Sethi's comment.
break on the ZForm_Load and single step through your code to see the last line before it hangs - it will propbably point to something
0
 
LVL 36

Author Comment

by:Zyloch
ID: 13975019
Unfortunately, while those are good thoughts, I deleted my entire code, and it still seems to malfunction. I'm beginning to think it's my computer but making a new form works... any other thoughts?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Expert Comment

by:andrewbleakley
ID: 13975044
What start-up object did you have ?
And what do you mean you deleted you entirew code ? Sounds scary ?
What controls are on the form ? Are they data-bound ? If you copy your controls to the new form that works does it still run ?
0
 
LVL 36

Author Comment

by:Zyloch
ID: 13975134
Lol, I just Ctrl-Xed all my code into Notepad to make sure it wasn't the code taht was doing it. I have a Winsock control, two text boxes, two lists, a bunch of labels, a timer, a menu, and some command buttons. It's not much so I can just redo it on another form, but I just want to know what's wrong.

I'm not too sure what you mean by data-bound, and if I copy the controls to another form, they work absolutely fine.
0
 
LVL 11

Accepted Solution

by:
andrewbleakley earned 800 total points
ID: 13975170
your timer code could be questionable in that it might fire and code inside could be locking.
does the host the winsock component connect to exist, because it could be timing out trying to connect.


explain the logic of your app and we can see what we can unravel
0
 
LVL 36

Author Comment

by:Zyloch
ID: 13975254
Ok. This is supposed to connect to an online xml file and get it then I can use regular expressions to tear it apart and extract what I need. I'm not great at VB and I specifically look up stuff I need -- for instance, say I need to know how to use regular expressions in VB, I'd just search on EE -- so pardon me for any beginnerness (is that a word?)

I tried first connecting with Inet, but apparently, I had to add multiple GetChunk or something like that to get all of the XML and then the states were a bit touchy feely and I couldn't find a comprehensive list of them.

I ended up using a winsock control and some code I got from another site. It seemed to work after the first time I press OK, then I went in and I think I set a value to a textfield and it just froze. I seriously doubt setting the textfield value was the cause of this, but it could be.

It could be the timer -- I'll check it out. Thank you for your suggestions! If this doesn't work, I'll probably just accept one of your answers. Computers are strange sometimes amen :)
0
 
LVL 14

Assisted Solution

by:Shiju Sasidharan
Shiju Sasidharan earned 200 total points
ID: 13975336
if u r using any loop there then try to place DoEvents Statement inside ur loop
like this

While ur_condition

    'Your code goes here
    '-------
  DoEvents
Wend


For i=1 to 10000

    'Your code goes here
    '-------

  DoEvents
Next
0
 
LVL 6

Assisted Solution

by:cjard
cjard earned 200 total points
ID: 13976337
jsut start the program by pressing F8

you see a yellow bar indicating what the computer is going to evaluate next. keep pressing F8 and watch the computer go through your code

at some point the yellow bar will disappear or get stuck in a loop. thats where your code is "freezing" (it isnt, its just getting INCREDIBLY busy)



ps; the whole idea of xml is that you parse it with an xml parser, not rip it apart with regexps.. youll make a lot of work for yourself if you do this
0
 
LVL 6

Expert Comment

by:cjard
ID: 13976344
pps; for downloading something with inet, dont use getchunk if youre a newbie. use OpenURL in string mode instead:

' A TextBox control named Text1 contains the
' result of the method. The Internet Transfer
' control is named Inet1.
Text1.Text = Inet1.OpenURL("http://www.microsoft.com")

read this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusinginternettransfercontrol.asp
0
 
LVL 36

Author Comment

by:Zyloch
ID: 13976357
Yes, except OpenURL always cut it off :(
0
 
LVL 11

Expert Comment

by:andrewbleakley
ID: 13976697
If openurl cuts off, i would look at the file you are downloading, there is no reason it should cut off -  internet explorer never cuts off. the only cutr of is if too much time passes without any traffic (as with any internet explorer download)

what is the size of this xml file you are terying to grab - and at what point in your app do you attempt to grab it ?
0
 
LVL 4

Assisted Solution

by:RichW
RichW earned 200 total points
ID: 13976943
It sounds like the State of your Winsock control is not resolving.  

Test the State of the Winsock by doing this:

Do Until Winsock1.State = 1  ' CHANGE WINSOCK NAME TO YOUR CONTROL NAME
    ' ANYTHING AT ALL HERE, OR EVEN NOTHING
    DoEvents
Loop

Place  breakpoint on the Do Until statement, then move your cursor over the .State portion of the statement.  It could be that your Winsock control is not connecting.

I hope this helps.

RichW
0
 
LVL 29

Assisted Solution

by:nffvrxqgrcfqvvc
nffvrxqgrcfqvvc earned 200 total points
ID: 13977019
In my experience I would bet its the winsock controls, I had trouble when using winsock controls on a form..heres what happend to me.(this is probrably your same problem)

I could run the the projects and connect using winsock, however if you dont close your winsock connection before unloading or termination your VB IDE will freeze upon hitting the square button to stop testing in vb ide..however I just added

on error resume next
winsock1.close
unload form1      
end          

 To both terminated and unload however use the X button on your form to stop running your code in the VB IDE and not the square stop button.
0
 
LVL 28

Assisted Solution

by:AzraSound
AzraSound earned 200 total points
ID: 13978810
Try the F8 suggestion...its good to learn how to use the debugger effectively anyways.
0
 
LVL 11

Expert Comment

by:andrewbleakley
ID: 13981106
On the same form try removing the controls (especially winsock) one by one and see what happens (copy the controls to another form so you need not recreate them)

But agree with crew - you should put you code back in and F8 your way through it line by line to see where you hang
0
 
LVL 36

Author Comment

by:Zyloch
ID: 13981135
Well thanks everyone. I'll just give up on this and copied the form to another one and it's working fine. Thanks for the time though :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question