VS 2008 For Loop Skipped - Bug?
Apr 30, 2010
I know it can be written better but the problem is: FOR loop is performed only first time BtnAdd1 is clicked. Why???? Private Sub BtnAdd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd1.Click
[Code]....
View 2 Replies
ADVERTISEMENT
May 9, 2012
If I try to debug the following code using the Test With -> Debugger option from within VS2010, it falls over on _object.DoSomething() with an Object reference not set to an instance of an object. error. It builds and passes successfully in NUnit.
<TestFixture()>
Public Class Tests
Private _object As SomeClass
[code]....
But should I need to do this or is this skipping of TestFixtureSetup when debugging by design.
View 1 Replies
Aug 24, 2009
If I comment the paramList line, I see the "CreateDetailedReport()" message box, but if I uncomment it, the message box never appears - there are no errors or anything, it simply seems to not run the function. On my development machine it works properly, but this odd behavior is seen on the target machine.
[code...]
Any reason why this would make the line before it not run - even without producing an error,o
crashing, or something?
View 1 Replies
Aug 11, 2009
I 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 Replies
Mar 14, 2011
Makes 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]...
View 2 Replies
Nov 12, 2009
Dim xml As New XmlDocument
Dim rd As XmlTextReader
Dim wrq As System.Net.HttpWebRequest
[code].....
View 1 Replies
Nov 19, 2010
I keep getting a notification that the application is already open. I have multiple users in different sessions on the box, and I thought I coded it right, but for some reason it loops still, but only with this one app??
vb.net
Private Sub clinicalLaunchorSwitch()
Dim CurrentSessionID As Integer = Process.GetCurrentProcess.SessionId
Dim hwnd As IntPtr
Dim prc() As Process = Process.GetProcessesByName("open")
[Code] .....
Maybe I just don't understand Exit For yet? I want to do something like:
For each instance of x.exe then t = t + 1
then
exit for t# of times. Is this possible??
View 6 Replies
Aug 26, 2009
I am very close to finishing this function, what I am trying to do is a for loop which:
1) Grabs the value
2) saves the value in an .xml file for later use
Currently when I use a for loop to feed in my function I overwrite the hiddenFields.xml on every pass, instead of adding to it.
Calling function:
vb.net
For X As Integer = 0 To postingHiddenFields
Dim hiddenFieldsReturned As String = functionDealWithHiddenFields(HTMLResponse, postingHiddenFields, X)
Next
[Code] .....
So basically on every pass of the function I'm overwriting the values instead of adding to them.
View 2 Replies
Jul 5, 2009
The following code is executed at an interval of 60000 milliseconds.
[Code]...
I tried doing a step through starting at a break point i put at the For Each line. It will go inside the For Each loop but when it reaches the first if statement and it finds that if statement false it will not go to 'Next' and continue to execute the loop instead it goes to End Sub. I want to be able to view what is going on inside the loop, i think the final upload process works so it does do the loop, though i can't step through to view it.
View 4 Replies
Aug 26, 2009
I can't think of a better way to do this, what i have is this function:
vb.net
Function functionDealWithHiddenFields(ByVal HTML As String, ByVal numHiddenFields As Integer)
[Code].....
which usually contains: 4 so when i loop out the names, it loops the 4 results, 4 times, instead of just showing me the names 4 times so i can then store them
View 2 Replies
Jul 30, 2009
I currently have a grid of 30 buttons, (6 x 5). So I named them btn1_1 - btn6_5
When the board loads up (this is for a jeopardy game) I have this
code
For counter = 0 To 5
Btn1_#.text = counter * 200
Next
Is there ANY possible way to do that (replace # with the number of the counter.) I doubt there is, but it never hurts to ask!
As a side note, where is a good place to post the jeopardy game that I am making in these forums, i tried both the code bank and gaming forums but they are dreadfully inactive.... since it is in VB.NET, i was wondering if i could post it here.
It is still in the making, but I would really like some feedback as i worked hard on it and got stuck for 6 hours on the save/load feature that was getting messed up cuz of a difference from A and a lol.
View 18 Replies
Aug 23, 2011
I can't use the normal method, my controls (picture boxes) names contain numbers such as 00, 01, 02 etc which corrispond to my multidimenional array.
I'm attempting change the picturebox's values in a for loop via the counter in the loop, for example:
For i = 1 To 4
PictureBox(i).enabled = False 'Picturebox1 will be the first one(counter starts at 1)
Next
I basically need to access each one as I would with an array, I can't type the full names out, can only refer to them via their names + counter number because I don't know what control name I would be dealing with at that time in the loop.
View 2 Replies
Sep 18, 2009
I would like to know which object shall I use to make a loop within a table. I was used to work with recordset object, working with EOF function in VB6. Now I am lost.
View 3 Replies
May 6, 2010
how can i loop until the last row of a data grid
I want to loop through a series of rows
Dim num4 As String Dim found As Boolean
HERE HOW CAN I LOOP to check if a nummber its found and if it is found then condition = true if its not found when finished the list the n condition = false For ver = 0 To 1105 (IDK HOW TO LOOP SO I DID THIS BUT DOESNT WORK CUZ IT CHECKS row FOR row RATHER THEN ALL OF THEM)
[Code]...
View 2 Replies
Sep 2, 2009
The code below finds a string from a text file and, if the correct month, - Monthcheck1, adds it as an item to an unsorted ListBox. I want to run through the text file again to find data for the next month. If I repeat this code for MonthCheck2, nothing is added. My question is: What is the convention for looping through the same file a second or third time?
[Code]...
View 5 Replies
May 14, 2010
I have a few labels on my form:
LblBtn0
LblBtn1
LblBtn2
ect..
I would like to loop trough the labels using the following
[Code]....
View 6 Replies
Jul 11, 2009
i have a program that is going to be disabling services depending on what is selected by the user via check boxes, and it would also add to the log if it failed or succeed ( the dim xfailed as integer ). There are a total of 73 options for services and i didn't feel like copy and pasting IF THEN statements for all 73. I was wondering if i could make a loop out of this?
The x would be the service name - ex. "Themes"
Dim x as serviceprocess.servicecontroller = new serviceprocess.servicecontroller(x)
dim xFailed as integer
Try
[code]....
View 8 Replies
May 9, 2009
I have a loop set up as [code]I need to know a way to break that loop at the current item it's on in the listbox (listbox1) via a button click (button8)
View 5 Replies
Jun 19, 2012
I was wondering if there was any way to stop a for loop untill i have user input, once the input is correct continue the for loop, is that possible at all
View 3 Replies
Aug 12, 2010
The problem is that the code is in a loop which i'm not sure how to stop.The need the text file to read all the file extensions.So i start looping through all the files in a folder.The other problem that happens is that i also need to loop through all the files in the folder so that i can compare the string line and the string X. So the final result is that my program is in one giant loop.
[Code]...
View 2 Replies
Feb 7, 2010
I m trying to use two datareader in same loop but its not working. Here is the error and code below Error line: DR1 = MyCommand.ExecuteReader()Error message: There is already an open DataReader associated with this Command which must be closed first.
[Code]...
View 2 Replies
Sep 15, 2010
I have about 1.000 text files in a folder, and I wanto to make some statistics reading the files content.In the first place I store the files path + name in a MyFiles() array, then, when I press a "Start" button I read the several files:
For x As Integer = 0 To MyFiles.Length - 1
FileReader = My.Computer.FileSystem.ReadAllText(MyFiles(x))
(data processing)
(data processing)
next
then I have copied and pasted the first 500 files in a new folder and added to the code if x > 500 the stop The strange thing is this: to elaborate the 500 files of the second folder takes about 4 seconds, to elaborate the first 500 files of the first folder (THAT ARE IDENTICAL TO THE 500 FILES OF THE SECOND FOLDER) takes 7 seconds.The same identical code takes different times to elaborate the same identical files if they are stored in different folders with different files number.
View 2 Replies
May 8, 2009
I need help to optimize this
For x As Integer = 1 To Me.dtsCustomers.Tables(0).Rows.Count Try
'I SEND VALUES: NAME CUSTOMER AND HIS AMOUNT
Dim client As WebClient = New WebClient<br/>
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("customer", Me.dtsCustomers.Tables(0).Rows (x).item("customer"))
client.QueryString.Add("amount", Me.dtsCustomers.Tables(0).Rows(x).item("amount"))
[Code]...
View 6 Replies
Mar 25, 2010
I have a question, i have worked in several languages in my life (including several versions of basic) but i wonder whether in .NET using a variable or equation in a loop is a lot slower than not using one? Take the following identical loops
Dim test(999) As Integer
For count As Integer = 0 to 999
test(count) = count
Next
[Code]...
Now the 2nd case is good because it is easier to adjust the code should the array size need to change yet my background tells me the 1st case is the one in terms of performance, test.Length - 1 is calculated each time the loop runs. a loop of the 2nd kind for example has a massive effect on java as well as VBscript or javascript.So heres the question, would test.Length - 1 be calculated each time the loop ran, or just the first time?
View 14 Replies
Mar 9, 2011
I know I am missing the obvious. I would like a label to show how many cycles in loop are left.
[Code]...
View 5 Replies
Nov 23, 2011
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 Replies
Jun 4, 2010
I am writing an application to compare each item on listbox1 to all items on listbox2. If the item is found, then remove it from both lists. The goal is to only have the items that were not found remain on both lists.
The problem is, the application just hangs and I never get any results. I looked at my code several times and I cannot figure out what's going on (programming noob I know.
[Code]...
View 4 Replies
Jul 9, 2009
I have the following Method:
CODE:
Everything is working fine except for one part. The part where the second foreach loop runs. If I only have one plugin installed it puts 2 entries in the list. The reason is because it has 2 rows and it is adding it twice. I know what the issue is I just am drawing a blank right now.
View 11 Replies
Dec 30, 2010
I am making a program thats going to be an msn style popup for reminders. I made an infinite loop to activate the popup when the date = current date. However its stuck in the loop and I cant run other functions while the loop is running. How can I get the alert to go off while also running the program?
Public Class Form1
Structure List
Dim Name As String
Dim Day As Date
Dim Hour As String
Dim Min As String
[Code] .....
View 4 Replies
Jan 27, 2010
I thought I could use this, to loop through all checkboxes in a frame:
For Each cb As CheckBox In Me.frameSearch.Controls
cb.enabled = False
Next
But it walks through once, then it comes with error:
Unable to cast object of type 'System.Windows.Forms.Label' to type 'System.Windows.Forms.CheckBox'.
There are indeed labels within 'frameSearch', but I thought that the "For Each cb as Checkbox" would loop only through all checkboxes..? Following does work, but it seems a bit of waste of CPU time, since it will loop through all controls!
For Each cb As Control In Me.frameSearch.Controls
If TypeOf (cb) Is CheckBox Then
cb.Enabled = False
End If
Next
How to do this more effectively?
View 12 Replies