Exponential Increments In A Loop?
Feb 17, 2009In a loop, i'm looking to add 1 to Var1's value everytime the loop goes.I've tried
[Code]...
In a loop, i'm looking to add 1 to Var1's value everytime the loop goes.I've tried
[Code]...
I am looking for a way to make my code shorter, how can I implement a for loop to do this:
Public Class frmWhatevs
Dim arrOne(8) As Label
Dim ArrTwo(8) As TextBox
Private Sub frmb_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetaArray()
SetbArray()
End Sub
[Code] .....
I am trying to implement a progress bar which increments based on a For Next Loop. The idea being that the increment should occur prior to the next go around of the loop. I have a user control form called "Progress" with a progress control on it called "Bar". The Min Value will be 0, Max 20, and Increment 1.
For X = 1 to 20
Code Here
'Put Increment here>>>>>>
Next
I have put the following code in the in the UserControl below. However its not clear to me how/where I trigger the bar to increment.
CODE IN USER CONTROL
Public Class Progress
Public Property Value() As Integer[code]......
I have a double type variable Sum and more than 1 textbox. When i divide one textbox value to another textbox value i got result of this type .00000000438000 and assign this value to another textbox. I want to change this value into exponentional form like 4.3*10-9. In which way i will change this value. I m trying my best effort bt i can't do this.
View 1 RepliesI've inherited a Visual Studio/VB.Net numerical simulation project that has a likely inefficient calculation. Profiling indicates that the function is called a lot (1 million times plus) and spends about 50% of the overall calculation within this function. Here is the problematic portion
Result = (A * (E ^ C)) / (D ^ C * B) (where A-C are local double variables and D & E global double variables)
Result is then compared to a threshold which might have additional improvements as well, but I'll leave them another day
If say in my datatable i have one column called order number and one column called line. Whats the best way to keep repeating the order number into everyrow, whilst incrementing the line number until i add a new value in the order number column.
So it'd go like this..
Order#______Line
4568________1
4568________2
4981________1
My application does some intensive tasks on a second thread, while updating the main form. I want to show how long these tasks have been running (increments every second), i've read timers can get out of sync and even fire off multiple ticks at once, so how can that be fixed, or what's a better solution for this?
View 3 Repliesi need a 2 digit prefix that increments. 1 - 99.. after reaching 99 it will be 100, that what im supposed to trap. if must be a0 - a9, after then b0-b9 ...... z0-z9.
View 3 RepliesI have a program in accounting that is used by many clients and users at the same time in a network. Many modules have a reference no. like in the receipt that increments upon saving, it also Checks whether that reference no. is already in used.
However problem arises when the many users use the same module at the same time. My question is How do you manage incremental values on each client's PC? Their local system somehow competes for the next incremental no.
I want to create hypothetically infinite array lists each that can hold hypothetically infinite items. The name of the array list is "arraycalc". How can I perform a procedure that will create a new array list called "arraycalc1"... the next time after that the procedure is run and a new array list called "arraycalc2"...and so on and so forth.
View 6 RepliesI need to create a table with just 1 column containing times (starting from 4hrs) which increase in increments of 10 seconds for each row. So it needs to look something like this:
04hrs 00mins 00secs - 04hrs 00mins 09secs
04hrs 00mins 10secs - 04hrs 00mins 19secs
04hrs 00mins 20secs - 04hrs 00mins 29secs
.....
06hrs 59mins 50secs - 06hrs 59mins 59secs
This will obviously take a long long time to hard code so I'm looking to create it dynamically. Based on what i'm currently trying to learn I'd like to be able to do this using jquery or asp.net (vb) but anything will do as long as it works!
I'm working on a function to return a exponential average and there are a lot of examples of exponential moving averages but they all start with a moving average that is just the mean as a lead in to calculating the continuing moving average. I needed just a exponential average of a value set. After Googling my Bing off I still haven't seen anything so here is my attempt at a basic exponential average. Is this correct? Are there any errors? I have seen some text about adding a smoothing value to change the curve of the exponential average but not how that would be implemented.
[Code]...
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]...
I am attempting to read the results from a SQL query into a List(Of) and I can see the List.count while adding items to the List increments, however in another part of my code when I am attempting to read the List the List.Count returns 0. My List is as follows:
[Code]...
I know I am missing the obvious. I would like a label to show how many cycles in loop are left.
[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 RepliesI 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].....
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]...
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 RepliesI 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]...
I am new to VB programming. I have the following code. When I execute my program only the last value from the loop is displayed in the label. I do write my code so that all of the values (years 1 to 5) show up in the label?
[Code]...
I'm completely new to working with more than one thread at a time but I've been reading up on backgroundworker quite a bit today. I get the general idea and think I could use it ok if it weren't for the fact I have a loop in a loop and I don't think they could be run inside a single thread together
View 4 RepliesHow do you convert a loop to a for loop
View 5 RepliesHow would I convert this Do While loop to a For...Next loop? I can't figure it out.
intCount = 0
Do While intCount < 50
lstOutput.Items.Add(intCount)
intCount += 1
Loop
Dim count As Integer
For count = 1 To 10 Step 1
Dim But+count As New Button
myButton+count.Width = 100*count
[code]....
Dim But+count As New Button => How to make it work
I'm slowly learning about loops. I have a couple of questions
1) When a condition is being tested.. what does that mean? I don't understand the "condition" word.
2) What is the difference between a loop that never ends and a loop that ends?
I have the code for the loop that ends and the loop that never ends. I can see the difference in the code, but I don't understand what is making it different. Here is the code below.
[code]...
I use the following code to add a row to an existing table
Dim newLineRow As DataRow = dsAccountDetails.Tables("Ph").NewRow()
newLineRow("Service TN") = "test"
dsAccountDetails.Tables("Ph").Rows.Add(newLineRow)
When I run the code it adds a single row to my table just like I want it to. However, when I put it in a loop it errors and tells me that the row already exists. The number of rows is always changing and I want to build the table from arrays. Why isn't the following working?
Dim a As Integer = 0
Dim b as integer= 5
For a = 0 to b
dsAccountDetails.Tables("Ph").Rows.Add(newLineRow)
Next
Currently, lets say that I have this code:
While r <> "HI"
r = RandomStringGenerator(1)
time = time + 1[code]....
how can I make it so that i can say basically this:
While r <> "HI" Or While r <> "BY"
r = RandomStringGenerator(1)
time = time + 1[code].....
But it still doesn't work! What's up with this?
Why does any app I make use 50% CPU while in a loop, even if the loop is doing simple evaluations, I've added Application.DoEvents() which stops the application hanging, but 50% is rediculous, what gives?
View 10 RepliesI have got this far and if you run it, it will do what you ask. Now when I type in 99999 or -99999 it will not end. Can someone tell me what I am doing wrong. I am suppose to loop until a sentinel value of -99999 is enter for previous meter reading.[code]...
View 2 Replies