Loops - How Many Times Is The Loop Executed

May 6, 2009

[Code]...

how many times is the loop executed? what is the value of i after the code is executed? if x and y are dimensioned as dim x(10),y(10,2) as integer, what would happen in the code? what would happen in the code if the first statement was for i = 14 to 12 step 4?

View 2 Replies


ADVERTISEMENT

How Many Times Is The Loop Executed

May 6, 2009

i = 5, j = 15
do while (i<j)
i=i+1
j=j-1
end while

how many times is the loop executed? is this 4?

final value of i? 9?
final value of j? 10?

when would you do a do while versus a for next loop?if the upperbound of a one dimensional array is 10, what is the size of the array? 11?CAN I GET HELP WITH THIS

dim x(20,2), y(20,2) as integer
dim i as integer
for i = 4 to 12 step 4

[code]....

how many times is the loop executed? 3?what is the value of i after the code is executed?if x and y are dimensioned as dim x(10),y(10,2) as integer, what would happen in the code?

View 9 Replies

VS 2005 - Loop Starts In X Then Loops Through Y 20 Times Then Goes Back And Finishes X

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

VS 2008 Prevent My Console Application Get Executed 2 Times At The Same Time?

Dec 29, 2009

I know something like this exists, I juts don't know the right word to search about it, so basically I have a cosole application and if it runs twice it crashes. I wanna dispay a message: Sorry app alerady running.I can look at processes and see if my exe is there already running but that's much harder.

View 2 Replies

VS 2010 - Nested For Loops Seem To Only Trigger Once Instead Of The Number Of Times That Specified

Dec 7, 2011

I am trying to code something with nested for loop with the following format:

[CODE]...........

However when the program hits the last value of 'For loop 1', the nested for loops seem to only trigger once instead of the number of times that i specified.

Private Sub populatedgv1()
'setup temptable to store Server data
Dim m_table As New DataTable

[CODE]........................

View 7 Replies

KeyPress - Beep And Loops - Occur Multiple Times During The Execution Of A Program

Aug 10, 2011

I've written a keydown event that needs to occur multiple times during the execution of a program, and it needs to play a sound each time. The first time the keydown event is triggered, the sound plays without a hitch. However, the second time (and all subsequent times) the keydown event is triggered, a system beep accompanies the sound. I'm using Studio Express '10 and I've already integrated e.SuppressKeyPress into my code:

[Code]...

View 4 Replies

Using A For Loop And/or Nested For Loops?

Nov 4, 2011

how to create this sequence using a for loop and/or nested for loops?

1
2
3

[Code].....

View 2 Replies

Do A While Loop When It Loops Through The Items From A List

Jan 20, 2012

I am used to C# and just started vb.net. I am trying to do a while loop when it loops through the items from a list.

While oResponse.outputControl.Items(i) <> Nothing
//Do something
End While

View 2 Replies

Reset A Loop So The When It Loops It Goes Back To 0?

Apr 8, 2011

In the first loop once it cycles through once it does not reset the data so it continues to hold the previous data so therefore the outcome is incorrect. Can I reset it to start back at 0?

[Code]...

View 4 Replies

Loops And Arrays - After The Loop Is Completed - Pull A Value From The Array And Display It?

Apr 15, 2012

i have a array set up, and i need the array to be global, but i can only get vb to accept it in a button, in addition, after the loop is completed, i am trying to pull a value from the array and display it but am getting an error.the code is as follows:

Public Class Form1
Friend staten As String
Friend statea As String[code].....

View 7 Replies

Run A Loop Multiple Times?

Sep 28, 2009

I read the lines from a textfile into a string array and then I use a foreach loop on the string array. I want to go through the same string array again after the loop reach the end of the string array

View 1 Replies

VS 2008 Very Different Times For The Same For Next Loop?

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

Delay Of In Interval With The Loop Of 10 Times?

Jan 12, 2011

i want to do this with the delay of in interval with the loop of 10 times.

for n=0 to 10
label.text="0"
time delay of 1 second
label1.text="1"
end loop

But when i m using executing the loop completes it iterations and timer just show work in last iteration.

View 5 Replies

How To Loop InputBox Multiple Times

Feb 24, 2012

I'm trying to loop the inputbox 5 times but I'm not sure how.
Dim payroll1 As String
payroll1 = InputBox("What is the payrolls for store1", "Inc", , , )
Lblstore1.Text = payroll1
I can get it to loop till a specific amount but not 5 times exactly.

View 9 Replies

Loop 25 Times As Atm It Keeps On Going And Wont Stop?

May 19, 2011

i have been working on maths game program for college and have advanced to the part where i have random questions asked repeatedly.

i need it to loop 25 times as atm it keeps on going and wont stop. also i need it to count how many are right, and each question they answer they get 2 chances to get it right or the game ends.but i dont know how to do any of this. this is my code so far for the questions

[Code]...

View 7 Replies

Loop Words For A Number Of Times?

Feb 10, 2009

Is there a way to loop words for a number of times (like i want to loop a word for only 10 times....How would I go by doing that?)

Quote:

Originally Posted by EXample Like I want to have a textbox and If i put 10 in the textbox It would loop the word ten times or is I put 20 in the textbox it would loop 20 times ..and ..etc...and ...etc...

View 11 Replies

Random Number Of 6 (1 ,6), And To Loop It 3 Times?

Feb 16, 2009

I need a random number of 6 (1 ,6), and to loop it 3 times. I tried this but it gives me error for - if myRandom.next(1,6) Then:

Dim myRandom As Random()
For i As Integer = 1, 3
If myRandom.next(1, 6) Then
End If
Next

Also I need to know the code for putting a picture into a picture box.

View 4 Replies

Forms :: Choosing The Amount Of Times A Loop, Or Sub Should Occur

Mar 29, 2009

I have made an app that the user has to type a number, and i want the process for the app to do this how evermany times the user wishes it to do.

for example, the app is ment to create a line in a text document, so they write in textbox1 what they want written on the line, and then in textbox2, tey say how many lines they want to create.

So,

TextBox1.Text = "BLAA"
TextBox2.Text = "782"

It will create 782 lines of BLAA. not just one...

View 2 Replies

VS 2008 - Make A Loop From 1 To 100 And Make It Everytime It Loops Display Incrementing Numbers To The Screen?

Aug 23, 2009

How do I make a loop from 1 to 100 and make it everytime it loops display incrementing numbers to the screen?

View 1 Replies

Monthly Payment Calculation, For Loops To Do While Loops?

Oct 8, 2011

the purpose of the program is to display the monthly payments on the loan.My homework is to use do while loops instead of for loop.Here is the code for the for loop.

Option Explicit On
Option Strict On
Option Infer Off

[code].....

Now I'm having some trouble displaying the output using the do while loop, and I'm pretty sure it's a loop problem on my code. However, I cannot seemed to find out what's wrong. I looked at the examples of do while loop in my textbook, but I couldn't find anything useful to my problems of my program.This is the output for the do while loop.

Here's the do while loop code

Option Explicit On
Option Strict On
Option Infer Off

[code].....

View 3 Replies

Save Multiple Times By Doing A LOOP Depending On The Number Of Checked Checkboxes On A Datagridview .NET 2010?

Oct 11, 2011

I have a datagridview with checkboxes in the first column and I want to do a loop on saving the serialnumber(s) when the users decides to check a number of checkboxes Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]...

the problem with this code is that it only inserts the serial number of the LAST checked checkbox and the number of entries of it depends on the number of checked checkbox for example ... if I checked the rows with the serialnumber 123 and 55652341, first the row with the serial number 123 then second 55652341, only 55652341 appears in the database and it is entered twice(twice because two checkboxes are checked)

View 2 Replies

When Break Out Of Loop / Break All Nested Loops?

May 11, 2012

So I have some vb.net code, and I have a nested For loop inside a For loop, and then I have EXIT FOR statement, will it break out of one loop, or the whole chain?

View 2 Replies

Contain Functions(They All Have For Loops) Don't Work In For Loops?

Mar 6, 2011

When I use a For loop in a For loop the Contains Statement dosen't work! Even my custom one! I even tested mine and it works 100% And neither that or the String.Contains function work inside of For Loops And, I know both of them use loops to search through a string.

My function(It will atleast search once):

Function RealContains(ByVal load As String, ByVal needle As String) As Boolean
load = load.ToLower

[CODE].....................

View 10 Replies

Will The "New" Bit Only Be Executed Once When The Function Is First Executed But In The Next Call, It Will Already Exist

Sep 27, 2009

I used to write this:

Private Sub Example()
Static CachedPeople As List(Of MyApp.Person)
If CachedPeople Is Nothing Then

[code]....

But then wondered if I could reduce this to:

Private Sub Example()
Static CachedPeople As New List(Of MyApp.Person)
...rest of code...
End Sub

will the "New" bit only be executed once when the function is first executed but in the next call, it will already exist.

View 1 Replies

Make Loop To Make Certain Thing Happen About 10-30 Times Without Taking In Too Much Memory / CPU?

Oct 16, 2011

A few years ago I have been busy creating this application but it didn't succeed, now Im coming back to it and similar problems occur. Basically I use SetPixel on a given window to draw a line, work fine, but the line goes away as the window redraws itself.The problem: I have been putting timers and threads on it to make sure the line is being drawn. Is there any way to make a loop to make a certain thing happen about 10-30 times without taking in too much memory/CPU?

View 7 Replies

Enlarge An Image Up To 32 Times Or 64 Times Bigger Than Original?

Dec 12, 2011

I want to enlarge an image, possibly up to 32 times or 64 times bigger than original dimensions (so that the user can see each pixel) if possible. The following is a simple function that I have to enlarge an image.

Private Function xEnlarge(ByVal Source As Image, ByVal Rate As Double, Optional ByVal Quality As Drawing2D.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic) As Image

[Code].....

View 6 Replies

Forms :: Find If Times Is Between 2 Times?

May 13, 2009

I have just started using vb.net and I have a checked list box with times throughout the day shown as

00:00 - 00:14
00:15 - 00:29
00:30 - 00:44
00:45 - 00:59

What I am trying to find is a way to get the current time and find which list item it fits into. What I think I need to do is to first of all get the current time and then go through the list splitting each item into 2 times and seeing if the current time fits. For example: Split the item 00:00 - 00:14 to 00:00 and 00:14 and then check if the current time is more than 00:00:00 but less than 00:14:59 and if so do certain task.how to go about taking each list item and splitting it into 2 separate times so I can check between them?

View 2 Replies

Evaluates Loop Condition In Do...Loop Statment To Determine Whether Loop Instructions Should Be Processed

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

Code Is Not Being Executed

Jul 4, 2012

My problem is that some code I enter will not be executed. Here is an example of my Form Load event. If i debug the code then the first two lines are executed. The MsgBox won't be executed though. or anything else after it. My programm does run perfectly. But i cant make any changes anymore It's driving me nuts, I don't have the faintest Idea what could be wrong. I sent the code to a friend and he isn't having any problems at all. We both use win7 64bit (he has ultimate, i have home) [code]

View 2 Replies

Only One Form Is Getting Executed?

May 28, 2010

I am developing a window application. I'm using Visual Studio 2005 and Mysql Database. The problem is, only one form is getting executed when I try to debug.I have changed the startup form to other forms(from a list of existing forms), but still that same old form is getting executed, even if I delete that form or exclude it from the project, it still keeps on executing.

Where this form is stored?(I deleted it from the folder where all other forms exist)

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved