How To Make A Loop
Mar 19, 2010Heres my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[code].....
Heres my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[code].....
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 RepliesA 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 RepliesBasically I have 10 .png images.They contain a walk cycle I need to make some kind of loop inside a timer to make them change.
View 2 RepliesHow do I make a loop from 1 to 100 and make it everytime it loops display incrementing numbers to the screen?
View 1 RepliesI managed to sort that problem out all by myself! I'm getting good at this. I just wonder if one of you could possibly tell me how to loop? I need to create a loop that counts up the a balance in a database then adds it together?
View 3 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]...
1) Diff b/w nothing & string in terms of variable declaration.
2)Erase keyword.I have never heard of such keyword in mine whole 1 + yrs of exp.
3) Diff b/w functions & properties? I say,Functions return a value,But propertiesare used to set or get the values. He say properties also return a value.
4)How can we use a class as a datasource?
5)Partial Class? hey frnds above question is for C++ na.Or there is also such class in VB.Net.
6)When the error stack overflow comes?
7) How we can we make indefinite loop , without uusing any variable declaration.
VB.NET While 1 = 1
Dim localRecv As New StreamReader(localClient.GetStream)
Dim aString As String = localRecv.ReadLine
localRecv.Peek()
MsgBox(aString)
End While
Basically "aString" will keep updating if new data arrives to the server. This way does work, and keeps MsgBoxing every time I get new data, but I don't wanna use While, I need something else, because It won't run any other code, just keeps looping that. :/
I have this code.I need to loop through it, until button 2 is pressed.I also want to count how many times its looped and show how many times in a label.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[code].....
I got my code and the number are finally right the only thing is i can not get it to loop right. It should ask the user if they would like to buy more bars and if they say yes it should continue if it says no then it should exit but everything i am trying is not working.[code]
View 3 RepliesI need an additional loop argument within an If statement that resides in a very large do...loop block. It will speed the application considerably if I can have the do...loop block loop prematurely. I already have the remaining code after the additional loop argument in a large if...elseif block to achieve the result, but making it simply loop instead of going through this would speed the application.
View 8 RepliesI am trying to make a loop that is going through my listviewbox.
Dim InterestPaid As Double
Dim month As Integer
Dim Principal As Double
Dim Balance As Double
[code]...
I am fairly new to VB (or any programming, for that matter) and assignment for my class. I am supposed to write an application that asks the user to enter test scores, and when they are done inputting test scores it displays the average. here is what i have so far...
[Code]...
I need to loop through textbox1 and every four "." make a insert "<br>" how would I go about doing this?
View 4 RepliesI try to make a loop in a table using dates i have this in a asp kode but can't make it work in vb
For i = CDate(strfradato) To CDate(str2tildato)Error1'For' loop control variable cannot be of type 'Date' because the type does not support the required operators.
I wanted to know how to make a loop of generating codes, that I create (from the push of button1) Like this:
Dim MsgBox As String
MsgBox = ("My code here, not a random one")
TextBox1.Text = MsgBox
[code].....
I have to create a Compound Interest Loop where I input a Mortgage amount and Mortgage Term (ie how many years the mortgage will span into another.) into two textboxes.
View 14 RepliesBasically what i need is for something to look at the items in a list box then compare it to the contents that is in the database. The issue is that the listbox can have more than one of the same item. For instance, LstBox_Order.items(0) could be the same at any position in the listbox. This code works, but it is slow if there is like 10 or more items added.
[Code]...
I am creating a button to save text files (Visual Basic 2005 and Windows XP). I made the following loop to give a default name for the file before saving:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'This loop is supposed to name the file "file10.txt", and if such a file exists it is
supposed to name it "file20.txt" then "file30.txt" etc.
Dim myFileName As String
Dim i As Integer = 10
myFileName = "D:filesfile" & i & ".txt"[code].....
However, the app gets unresponsive only after one round in the loop (when the file name is "file20"). The loop gets stuck at the following line:
If IO.File.Exists(myFileName) = True Then
This line works only once and after that it becomes unresponsive.
How to make a loop wait until a button is click?
View 19 Repliesmake blinking shape in different colors using for loop?
View 2 RepliesI want to make a loop that only loops if the serial link is open and Button3 (which writes a stop signal to the program) is not pressed. I've gotten as far as this: Do While Serial.IsOpen = True & Button3. but do not know how to tell the while loop to stop when Button3 is pressed.
View 2 RepliesI have this do while loop that I am having trouble with. I need to know how to make the loop continue to the next line after it has looped around once. So far I have it outputting like this.
$*$*$*$*$*$*$*$*
But what I really need it to do is output like this
$*$*$*$*$*$*$*$*
*$*$*$*$*$*$*$*$
$*$*$*$*$*$*$*$*
*$*$*$*$*$*$*$*$
$*$*$*$*$*$*$*$*
*$*$*$*$*$*$*$*$
$*$*$*$*$*$*$*$*
*$*$*$*$*$*$*$*$
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?
I wanted to know how to make a loop of generating codes, that I create (from the push of button1) Like this:
Dim MsgBox As String
MsgBox = ("My code here, not a random one")
TextBox1.Text = MsgBox
I want the textbox's code to change into another code, that i want, from the push of button1?
Imports System
Imports System.Net
Imports System.IO
[code].....
I have a BackgroundWorker and the DoWork event, calls a function called "JustMe", it executes a loop to make visible all the controls on a panel, but does not work vb.net
Private Function JustMe As Boolean For Each ctr As Control In Panel1.Controls ctr.Visible = True Next Return True End Function Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
JustMe()
End Sub
I have made a For next loop with an array. I want all my picture boxes to follow each other within the loop. I have currently been using old code, but not in a loop or array format. The old code works. The array code only makes the 2nd picture box follow the FIRST one. It doesn't loop the rest. I have checked the code and cannot determine any mistakes, else I'm missing out on something I haven't been taught.[code]...
View 17 RepliesI 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.