IDE :: Loop Causes Program To Freeze?
Feb 14, 2009My following code hangs my VB IDE. What could be the reason. I am of the opinion that by 'sleep' I am avoiding a tight loop and so the program should not freeze. What should I do?
[Code]....
My following code hangs my VB IDE. What could be the reason. I am of the opinion that by 'sleep' I am avoiding a tight loop and so the program should not freeze. What should I do?
[Code]....
I'm having some wierd problems with my Looping. I'm was using a thread to start a looping routine to sample the keyboard for pressed keys. The loop worked fine when I made a call to it from the thread in my form load routine. However when I just made a call to the samplekeys routine without using the thread my application will freeze and it won't load.I'm making the call in the form load routine. Private KeyThread As NewThreading.Thread(AddressOf SampleKeys)hen start the thread in the form loading procedure , but if I just make a direct call to the samplekey routine without using a thread my application freezes.Here is the the thread don't think there is a problem with it.
Public Sub SampleKeys()
Dim N As Integer
N = System.Environment.TickCount
[code].....
I'm using loop to read data from sql and then make some calculations then save it again to another table but when application loop for 3 or 4 times it's freeze but the job is done but if loop = 10 or more then it is freeze and hangup for long time .i need to learn how to make my application working better and never freeze and make application working with any count for loop without freeze .
View 7 Repliesmy program freezes untill the loading has finished.Is this normal? And if it is then how can I prevent my program from not allowing me to go back to the other form untill the loading has completed?I'm using this url as a start up page for my custom browser;so can I prevent my program from freezing or not ?It looks as if my custom browser form keeps demanding focu
View 5 RepliesI am making a program that loads, edits and saves 5000 rows x 100 columns of data. The data is stored in a datagridview. I use these commands to write the file:
dim z as integer
dim z1 as integer
fileopen(1,"c:drawermyfile.txt",openmode.output)
for z=0 to datagridview1.rows.count-1
[Code] .....
Every time I issue this command the whole program freezes until the computer is done writing the file. Is there some way I can get it to write this file without freezing up the program? Or, perhaps a better way to write this large data file?
I am constructing a program, i am new to Visual Basic, but i have past programming experience. I was wondering if anyone knew how to form a loop that could...lets say calculate the answer when two numbers are added together,and it would repeat this thousands of times, etc. And if there is a way, would it be possible to calculate the time taken to complete this loop.
View 5 RepliesI assigned an integer as 1, and looped my program using:[code]I can recieve the packets without looping, but once i loop, i receive nothing.
View 29 RepliesMakes the following statement about the code below:
**"The computer evaluates the loop condition in the Do...Loop statment to determine whether the loop instructions should be processed. In this case, the inputsales <> String.Empty condition compares the contenst of the input sales variable to the String.Empty value. As you know the String.Empty value represents a zero length, or empty, string if the inputsales variable is empty, the loop condition evaluates to True and the computer process the loop instructions. *If on the other hand the inputsales variable is not empty, the loop condition evaluates to false and the computer skips over the loop instructions.
Based on the code I think it is the opposite: ...that while the inputsales value is not empty it should evaluate to true and process the loop and if it is empty it should evaluate to false and skip the loop?
See below.
Option Explicit On
Option Strict On
Imports System.Globalization
[CODE]...
my program seems to just freeze whenever I press this button. I need to be able to use this because I'm reading values from a joystick as i'm making a human interface device.
Why is this freezing?[CODE...]
How can i make a trial program that has a 15 second countdown timer before the start button is active?[code]...
View 2 RepliesI am using VB 2101 express, I am try to right this program but it will not go past the end of my loop, does anyone know why?
If (Not System.IO.Directory.Exists(root + "setting")) Then
System.IO.Directory.CreateDirectory(root + "setting")
End If
[Code].....
I need to write a program in vb.net using Do while, for next and do loop. Th eprogram will sum all the even integers between 2 and 50. This is what I have so far
Dim intCount, intNumber as integer
intCount = 0
intNumber = 0
[code].....
I have a dgv, I populate it, and I insert a row at the pos 0. And I want to freeze this row even when the user sorts the dgv.
How can I make this? The frozen property alone seems to be not enough.
Currently I have to retrieve over 2000 records from DB and bind with combobox. and then follow with another 3 retrieving (less than 20 records)
My problem is when I call this function, my GUI became freeze.
I try to use Application.DoEvents() method but it still didn't work.I read some post and pages, they mention about BackGroundWorker and .Net 2.0. But what i use it MS 2003 with 1.1 so i think i can't access BackGroundWorker.
I would like to loop over two string arrays but does not work.[code]...
View 4 RepliesI have this function for removing duplicates in arrays[code]...
What is happening at the moment is that the inner loop reaches the array.Remove(inner_element) line for the first time in its second loop during the second loop of the main foreach, reaches the inner next line and then just stops executing. There are no warnings / notices, the debugging step though just ends as if there was no further logic.
I am attempting to freeze the top pane of an excel spreadsheet, which I have opened via my application. The most used method from various internet sources is: [code]
View 2 Repliesok i have this code for a banner changer i wrote for an app but i have an issue the code works it gets the banner url from the mysql database useing this code[CODE]......
so im at at loss how do i get it to work so the GUI is still useable while it gets the banner ?
Using DataGridView with VB.Net 2008.I would like to freeze the left column so that when/if scrolled this column still remains in place.
View 1 RepliesI've been having a bit of a problem using the while function.
Here is my code (Simplified):
Dim RandomNumber3 As Random
Dim RandomOutput3 As Integer
[CODE]..............
When running the debug, the program crashes, and when I step into the program, I find that this While statement becomes an infinite loop. This is a program that uses random number generators to assign a value to something, and this while statement is necessary so that there is never two of the same values showing (RandomOutput, RandomOutput2 & RandomOutput) Have to be different to one another.
I use these codes to download/upload to my FTP host , they work perfectly but since i have to handles few download/upload , sometimes the application freeze during download
'Upload :
Try
' set up request...
Dim clsRequest As System.Net.FtpWebRequest = _
[Code].....
Is it possible to freeze a remote computer? thru the ip address.
freeze computer meaning temporarily disable the mouse and keyboard of that remote computer
I'm experiencing an error which complexity and way to approach I can't quite understand.. It looks like two threads not able to work simultaneously.The first thread is the normal program thread, and the problem occurs when the user clicks a button. This sends some messages through a method (PlaceOrder) of an API library object. This method is called 2-3 times in a loop. Handlers have also been added (on program startup) to receive callbacks on events raised by that object, and this is the 2nd thread that contributes to the error.
The error seems to occur when the PlaceOrder method is called while receiving an event from this same object.The result is that the UI freezes. I can trace the error in two places. If I trace the first thread (which is the initial program thread); the freeze occurs when reaching the lock(this) line, in the API-object class. If I trace the callback event, the handlers of this event try to invoke a RichTextBox on the form, and the freeze occurs on the line <RichTextBox>.Invoke(....), as indicated below.
The thing is that when pushing the button, there is a loop which calls the method of the API-object 2-3 times. And the first time succeeds, but the 2nd time it seems to crash in some way with the callback. It would be nice if I had made some silly mistake with the invoke code, but I don't think I have, as it updates fine prior to the error.. I'm not sure, but it may be relevant that it's in fact the same object, so early in my program I add this event listener (which is the one that updates the RichTextBox):
AddHandler ibclient.Error, New EventHandler(Of ErrorEventArgs)(AddressOf client_Error)
..while later, related to the freeze, I have:
ibClient.PlaceOrder(....)
But I'm handling a lot of calls forth and back other than these, and haven't experienced any problem before.it doesn't give any exception or error message, it just freezes.The invoke stuff in the form code, which should be as per trusted examples: (Freeze occurs at blue highlight)
Private Delegate Sub SetRichTextBoxInvoker(ByVal message As String)
Private Sub OnLogUpdate(ByVal message As String)
If Me.rtbTwsMessages.InvokeRequired Then[code]........
First off I'm using aspx pages with Visual Basic .net 2008 for the code behind.
I'm using a FileUpload control on an aspx web page to upload files to the server.
When I click on the Browse button I get a dialog box to select the file. I select the file and click the Open button and the entire file path populates the textbox portion of the control, just as it should.
However, when I use the same process to select a second file, after clicking the Open button it takes over 2 minutes for it to populate the textbox portion.
I have a RichTextBox (txtCustomDict) ... and i am invoking it like so from another thread:
[Code]...
EDIT: Just checked and it does the same thing if i split it into 2 differently named subs then invoke the other sub
I have an app with which I populate a DataGridView named data. I have implemented threading in this app. Now both in debug mode (run through VS 2008 Express Edition), and without threading implemented the app works smoothly as it should. With threading and as a standalone .exe however, it freezes up. Not just anywhere, but as soon as 6 items are filled in the DataGridView (the top of the last one is only slightly visible). I have synclocked everything relating to the DGV, and am completely stumped.
View 7 RepliesI just put a button and a textbox on a form to try and learn to multi thread, i think i've done it correctly. but it still appears to freeze for a little bit just before it attempts to display the data. i think it's the invoking. Is it normal / have a done something wrong?
[Code]...
I am new to LINQ to SQL and I try to Edit and Add a New item on a Windows Form in VB.Net, the form freezes? By example, when I try to select a value from a combobox the prompt get stuck (it enters in Enter event) and it cannot exit, then the form froze.
View 3 RepliesHow to initialize a multidimensional array by loop operation in VB .Net?
I have some arrays called 'Room', 'Subject', and 'Population'.[code]....
I have items in a listbox control that I would like to repeatedly (when it gets to the last one, repeat) loop through and set the text to a label.
View 2 Replies