VS 2005 An Illogical Loop?
Aug 11, 2010
This is confusing the poop out of me.This is a loop at which, on the last iteration,decreases the size of the loop's maximum count, and also decreases the loop counter.
Dim maxValue As Integer = 5
Dim iCount As Integer
For iCount = 1 To maxValue
[code]......
View 6 Replies
ADVERTISEMENT
Apr 29, 2011
i need assistance in for each loop in vb.net 2005. that what is this for, why we use it, what is its syntax and where we need to use etc etc etc....
View 3 Replies
Sep 13, 2011
I have more than ten groupboxes and will increase in future so I am trying to something like this:all groupboxes are visible = false and there is a textbox which shows a random number from range of 0 to number of groupboxes..Now I want make a certain groupbox visible whatever number is textbox for example:textbox1_text change event:textbox1 = 6..so groupbox6 should be visible = true and rest of them should be visible = false..I tried it manually still its not working.
View 4 Replies
Nov 15, 2009
I need to create a variable number of Group Boxes, at runtime, inside an existing Layout panel. The name of the Group Box also needs to contain the integer, from the loop, as part of its name. i.e x = 1 to 3 > GroupBox1, GroupBox2, GroupBox3
View 5 Replies
Jan 9, 2011
I am using the following code to return the long and lat of a property, how can I create a loop to return the same for multiple address's?
[Code]...
View 10 Replies
Feb 22, 2010
I'm making a rock paper scissors program and once I set the current_scene variable to 1, the MainLoop() sub doesn't keep looping, but the sub doesn't exit either. (Form1.vb is the most important file.)
View 9 Replies
Jul 23, 2009
I have a Collection, the keys are strings and the values are Collections. In the sub Collections the keys are strings and values are Singles/Floats. How would I loop through all of the data? I need to get the keys and values not just the values. I've tried this but it produces a cast error:
[Code]...
View 3 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
Mar 25, 2009
My application uses 12 checkboxes. Dependant on the status (checked or unchecked) different action are required. I can't seem to be able to structure a for next loop to do this.
View 7 Replies
Jan 13, 2010
The following code works fine, however if the user wants to cancel out from the openfiledialog they cant they are stuck in a loop. A loop I created in case they selected the wrong type of data file they could choose again. [Code]. I really need some help seeing where and how to let the user cancel out without the program continuing. I tried some dialog.dispose code but everywhere i seem to put it it generates an error somewhere.
View 4 Replies
Apr 9, 2009
Private Sub CopySelectedNodes(ByVal nodes As TreeNodeCollection)
For Each node As TreeNode In nodes
If node.Checked Then
'MessageBox.Show(node.FullPath)
Me.CopySelectedNodes(node.Nodes)
[Code] .....
This does not work, I want to loop through results so the textbox1 will be like 151,154,3,151, and I want to remove the last.
View 2 Replies
Mar 14, 2010
how do I set an object array using a loop so I don't have to type each button name?
[code]...
only problem with that is it assigns a string value. I need it to assign an object. any suggestions?
View 11 Replies
Jul 1, 2009
I often use a for/next loop to cycle through a collection to find a particular member of that collection based on some criteria. This works fine in every case except one: when I want to then erase the very member of the collection I just found. For example, if I wanted to give the heave-ho to every obect in a collection class that has a member veriable Color equal to Red:
[Code]...
The problem is once the collection class member is erased it makes to loop invalid because taking out the member reduces the total count of the collection in the middle of the loop. Eventually I get a "Index is out of range" error.This circumstance has bothered me every so often; I bet more experienced programmers have a different type of loop system that works better than this when you want to erase a collection member.
View 2 Replies
Jun 15, 2010
I'm selecting multiple files from a FileOpenDialog box. Now I want to store the names in an array. This is what I'm trying to do:
For i = 1 To fileOpenDialogOpen.FileNames.Length
ReDim Preserve fileList(i)
fileList(i) = fileOpenDialogOpen.FileNames(i).ToString()
[code].....
View 6 Replies
Aug 18, 2010
I'm trying to make a simple game tree.Previously I used nested loops:
[Code]...
View 10 Replies
Mar 2, 2010
I am trying to make a collection of controls that I can loop through. So I have this code in my form... Dim WizardFrameCollection As New Control.ControlCollection(Nothing)
I then try to add controls to the collection by I get a error "Object reference not set to an instance of an object." WizardFrameCollection.Add(Me.GroupBox1) I am not sure why I am getting this error. Groupbox1 is a groupbox that is on the form.
View 2 Replies
Jun 30, 2009
Private dt As DataTable
Private ds As DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Row1 As DataRow
[code]....
I want to change the font to bold of the current row in the loop and i m also binding the datatable with datagrid as it is in code..
View 1 Replies
Jun 1, 2011
if I have the following vb code,
for i = 0 to dTable.Rows(i).Count -1
Dim sql As String = ""
Dim strConn As String = ConnString
[Code]....
View 10 Replies
Feb 20, 2011
I am using the following code to get distance between two propertys. The problem i am having is each Distance Calculation is being obliterated and I am only geting back the last Calculation instead of each calculation/distance
[Code]...
View 4 Replies
Dec 6, 2010
The following loop starts in x then loops thru y 20 times then goes back and finishes x. how do I get it to loop thru x then complete loop y then loop x once more then loop y completely again 20 times then back to x and another 20 ys. there should be 200 loops today.
CODE:
I need to figure this out as part of a larger program.
View 1 Replies
Apr 22, 2009
i got error when
1.) Looping exceed the images files found in the folder
2.) When program get not valid file
3.) when changing the source of images
the error says "Parameter is not valid"
here is the code below....
Function getnewImage()
Try
If (Me.Ping.Send("pc1", 6000).Status) = Net.NetworkInformation.IPStatus.Success Then
[Code].....
View 6 Replies
Jun 23, 2011
I am writing an app to be a single button failover of a set of mirrored SQL servers. The app has to handle several other functions (enable/disable and start/stop of services, writing to local registry, copying files from server A to server B, initiating stored procedures, etc.)I have a collection of labels that indicate the status of 4 services on 2 servers, I wrote a function to check the services when passed the machine name, and the service name. Originally I just called the function 8 times (4 services, 2 machines) and populated the labels 'manually'. I have all of this within a timer so that the service status is refreshed every couple seconds. Id like to clean up the code to a single for/next loop that operates on 2 arrays (an array of service names, and an array of labels) such as:
'**Fetch_Status is the function that gets service status, it accepts 2 strings, machine name
'**and service name and returns status "running", "Stopped", as my_status
Dim Services() As String = {"Service1", "Service2", "Service3", etc.}
[code]....
The only reason I want the control array is to be able to use the .Text and .BackColor properties of the labels in the loop. If I make an array of strings with the label names it doesnt seem to pick that up.
View 6 Replies
Mar 26, 2010
I have created a datatable and now i need to print it,so i did the following:
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim xPos As Single = 20
[CODE]...
The code works fine.But in the above code as you can see that i am printing the each rows content of the datatable one by one and after printing all the contents of a single row i am looping the code again for printing each and every row present in the datatable. So i want to know that inspite of printing each and every data present in the row of the datatable,is it possible to print the entire datarow at a time and then loop through all the rows present in the datatable?
View 20 Replies
Jan 10, 2009
Not sure how to arrange this, or if I should be using if/then statements
'dim data location (Still can't figure out save/retrieve methods)
'more dims likely
Dim rand As New Random
[code].....
View 5 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
May 3, 2010
I have written a function that gets the alexa ranking of a given url, now this function works perfectly but I want to loop through a ListView of urls and grab the alexa rank of each item (url) with my function.The code works great if I put a MessageBox in the loop to test that the function is returning a value but when I remove the MessageBox the loop does not work.I need it to loop through adding each result without a MessageBox stop in each loop.
vb
For Each Item In ListView1.Items
Dim result As Integer
result = GetAlexaRank(Item.Text)
[code].....
View 12 Replies
May 31, 2010
So I made a simple patform game where the player has to jump quickly while the platforms move to the bottom of the screen, as to not touch the bottom of the screen. But, I need to know how to create a loop to loop the locations of the platform. This means that after twenty or so platforms, the same platforms come up again, so that the player will have an "endless" game. I've declared all the platform's locations relative to the location of the first repeating platform:
[Code]...
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
May 29, 2012
I have this little application that runs a SQL query works great, now I want to have a Start Button run the and display results then System.Threading.Thread.Sleep(300 * 1000) for 5 min then run again and display results and loop till I buttonstop_click. unsure if the sleep is the best method.
[Code]...
View 2 Replies