VB.NET Tutorial 15 - For Loop (Visual Basic 2008/2010)

preview_player
Показать описание
This video tutorial will teach you the first of the three loops, the For Loop. This loop is extremely useful in Visual Basic .NET programming and can be used to execute code as many times as you want it to.

For more information, check out the website:
Рекомендации по теме
Комментарии
Автор

@Cashliek
That's because you need to display the value of i, not the value of 1. Change the messagebox to ("The value of i is: " & i)

TeachMeComputer
Автор

Great Series I am watching every one of them and learning much faster than in my class

iridetoofast
Автор

I didn't like until this video. Keep it up, you are doing good!

cityvoyage
Автор

For those that don't get it, he said "i" as integer = 0 in the code. An integer is a whole number. So "i = 0" will be "i" as a whole number that equals 0.

When he says "For i = 0 To 10"
That tells your program that "i" being 0, will loop the code "Messagebox.show..." until i = 10 then your program will stop looping that code. So it's just a way to get something to happen more than once. So the message box will appear 10 times with his code. The code to make the message box loop 10 times. Get it? Good.

Flamo
Автор

Your tutorials are awesome, thanks for your work!!

mrich
Автор

Great! Thank you, you've made this easy to understand. Quick question though, is it possible to use a loop like this for images instead of numbers? So that it goes from picture 0 to 1 to 2 to 3 etc.

bluebatteries
Автор

I got your point perfectly fine. what i have in my mind is i have to press close button 10 times. If I want to see the all values of I at one time how can I do. that. like in vb there is print function which print the values of I on form. but how in vb.net.

handarakesh
Автор

@FrozenScriptz - Wrong. FOR a = 1 to 10 would run 10 times. Your FOR loop would run 11 times.

Let's check how would your loop work:
1st run: A=0
2nd run: A= 1
3rd run: A = 2
[...]
11th run: A=10

IvanVinski
Автор

Could you make a presentation about horse race, with bets, odds, and the amount of money betting in each horse? Thanks.

msmusa
Автор

"FOR" has a known number of paces. Think of it like this, DO {instructions} from 1 to 10, So it will do 10 executions. "WHILE" has an unknown number of paces, as you can think of it --- WHILE (n==0) execute something. "DO WHILE" is more useful, when you need to execute first, and then check the condition. Do {instructions} while (n==0). So it will execute before checking, and after that if n=0 than it keeps on executing.
I'm not familiar with Do Untill, i'm sorry.

Hope it helped!

photoguy
Автор

Try using a timer instead and use intervals.

FursonaNonGrata
Автор

Quick question, if you want to show the "do while", "loop", etc looping sequence in a label.text; how do you do that?

It seems easier with the messagebox.show but my dumb teacher wants me to actually go in order. He's teaching us how to represent solutions on label.text format.For example; he told us to right a solution for a " penny doubled every day for thirty days" using "DO WHILE";so we have to show him how the number increases each time you hit the button but on a LABEL.TEXT.Thx 4 d tut.

voteboo
Автор

For all those who do not understand;

Dim a As Integer = 0 (Declare variable a as an integer and set to the value of 0)

For a = 0 To 10 (Since a = 0, loop will run 10 times)
your code goes here;
Next
after the code above this will run. (Example: The for loop ran 10 times, NEXT it will do this.)

FrozenScriptz
Автор

are we can make a progress bar using for loop?

MrVincentchuan
Автор

can i set a time for each time i want it to loop?

hackandtech
Автор

What if it's a label you want to change instead of a message box? Ty in advance

CAGFlores
Автор

How do you get the little arrow looking thing next to the eye in MessageBox.Show("The value of i is: ") _ i. Underscore being the symbol

CanadianPancakes
Автор

Sorry but, which part of the code makes the addition task, adition of "1" at each step??

iyunt
Автор

I need to run a loop using a listbox. The user needs to enter a number any from 1-12 ad the timestable is supposed to show in the list box. How can i run this and will i need a list box a textbox and a button?
If you can answer pls. thx.Claud

kingsnake
Автор

How would I make it so you could like input a number, and it would do it that many times?

Bahookers
join shbcf.ru