Distance Calculator - Loop Not Working
Nov 4, 2011I can't get the loop to work.
View 1 RepliesI can't get the loop to work.
View 1 RepliesThe calculator is suppose to show how far someone goes for each hour increment (i.e. if they punch in 3 hours, it should show a number for 1 hour, 2 hours and 3 hours; if they punch in 10 hours it should show a number for 1 hour, 2 hours, 3 hours....etc. up to ten hours, etc.) I can't get it to show anything except for the total number of hours traveled and total distance.
rivate Sub DistanceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DistanceButton.Click
Dim speedIsValid As Boolean
[code].....
I can't get the loop to work. The calculator is suppose to show how far someone goes for each hour increment (i.e. if they punch in 3 hours, it should show a number for 1 hour, 2 hours and 3 hours; if they punch in 10 hours it should show a number for 1 hour, 2 hours, 3 hours....etc. up to ten hours, etc.) I can't get it to show anything except for the total number of hours traveled and total distance.
Private Sub DistanceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DistanceButton.Click
Dim speedIsValid As Boolean
[Code]....
I've to do this application whose purpose is :The application computes the number of miles traveled given the speed limit and the number of hours to be traveled in one day.Restrictions: The number of hours for one day of travel should not exceed 20 hours.
Public Class frmDistanceTraveled
Private Sub btnCalculateDistance_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateDistance.Click
[code].....
1. My input box does not prompt
2. Then a loop should be used to display in a list box the distance the vehicle has traveled for each hour of that time period.
[Code]...
Here is the code. The only problem I am having is getting the total miles to display. How do I get my listbox to show my total miles broken down to hour1 xx miles. I can get it to show the total miles per total hours driven.
Option Strict On
Public Class frmDistanceTraveled
Private Sub btnCalculateDistance_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateDistance.Click
' The btnCalculateDistance event hadler calculates the distance
' traveled
[Code] .....
I am attempting to write a speed/distance calculator using visual basic 2008 express edition. I have gotten the program to do most everything I need but am having some difficulties and have been trying to fix them for 2 or 3 days now without any success. Will somebody, anybody please tell me how to fix the problems.The calculator should display the distance traveled when the speed and time are entered. This is the only major requirement. However, It needs to have all info input via a list box with popup windows displayed for speed entry and then again for time entry. I would like a label outside of the list box to show "Total Distance Traveled" and I would like the list box to display the following information
[Code]...
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]...
You could check to see if the distance across the form minus the distance across the picture box is equal to the horizontal location of the picture box to see if it's on the right side. For the left side, just check if the horizontal location of the picture box is 0.
View 2 RepliesI've been browsing these forums the past couple days, and I've got most of my program figured out now, but I'm seeking advice as to where I should do a few calculations, and how I should pass my data between my input and my output forms. my basic program consists of a user entering 4 positive values on my main form - and then I calculate various constant percentages based upon these numbers. I then need to output these values into various labels on my output form. I have successfully implemented doing all of this on a single form, but I have over 30 outputs to display so it was a bit cluttered on a single form.
1) is it better to do all my calculations within the code of my input form and output the calculation results to the output form, or is it better to take my inputs, send those 4 values to the output form and do my calculations and output there? (i'm thinking it's the latter and is how i'm currently coding this)
2) in my second form, I cannot remember how to pass values between forms and I have not been able to find any examples that have jump started my brain into remembering. Currently I'm planning on sending my 4 inputs to the output form, doing the calculations, and outputting everything there.
for my input page:
Public Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
'each textbox is programmed to only allow numerals
'Get input from user
[code]....
and i think this will have the form calculate everything when it loads up. I'll later add code so that after I close it - I'll have my input form reset so i can immediately run another set of calculations. (currently not programed, i need to get the basics up first)
I am here again begging for help with homework. I have to write this program to display three mortgage payments simultaneously using an array for three types of loans, that part of my program does work... Then I must amortize all three loans at once using a loop for comparison so the user can see: [code] I can't get the amortization to show. [code]
View 7 RepliesI am having a problem trying to pause/hesitate my loop for a couple of seconds and then iterate through the loop, but pauses every 10th iteration. I have my loan amortization displaying correctly but cannot get it to pause to list only 10 items at a time. 'This section uses the for loop to display the Loan Balance and Interest Paid over the Term of the Loan.
Dim counterStart As Integer
For counterStart = 1 To LoanTerm
'Performs Calculations for Amortization of loan.
InterestPaid = LoanAmount * InterestRate
[code]....
I am having trouble getting the numeric keypad on my keyboard to work with my calculator. btn0 - btn9 are working, but the numeric keys +,_,*,/ are not working. They input the sign into the text box instead of clicking the button associated with the function on the calculator. I would like to be able to use the calculator as a 10 key adding machine of sorts. [Code]
View 5 RepliesAll i made was a program to launch diffrent programs ^^. This is what I am currencly workin on: A calculator to calculate waves for example Wintermaul. I have writen this code:
[Code]...
I am slowly learning to program in visual basic and just spent the past 5 hours trying to fix this but just cant.
View 8 RepliesI am working on a calculator that does the annual percentage rate. The code has to use a For Loop (which I am new to). This is the code I have so far.
[Code]...
assuming i have an isoceles triangle, where i know the height + base width, how
can i calculate the width of that triangle at 1/3 of the distance from the point + 2/3 of the distance from the point?
i thought it'd be simply 1/3 base width + 2/3 base width, but my drawing is +/- a few pixels when i resize it?
when i try to increment the for loop it jumps to case 5 of the select case statement. What i actually want is when i press the Next button it shows me a set of options which is case 2, but now it straight away jumps to case 5.
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim counter1 As Byte = 1
For counter1 = 1 To 5
Select Case counter1
[code]....
What I'm trying to do is first calculate the deductions (0.5 and %7) amount form entered visa amount, then send remaining amount to cell "B6" in my workbook sheet1. if there is more than one visa then I need to see total of all visas after deductions in cell "B6". [code]
View 16 RepliesDim cv As Integer
Dim cc As Integer
Dim CurrentValue As Double
Dim ObsoleteValue As Double
[code]....
Basically this code works for the first column of the DataGridView. It sort of stops iterating after the last calculation of the row is performed and doesn't change the cc value at all. Meaning the loop gets stuck after the first iteration.
I have a list of string in an array. I'm loop through those strings and if the text of a combo box matches one of those strings, I want a message to appear. If they don't match, I want a method to be executed.
[CODE...]
The messagebox appears, but the method is still executed. Which means it isn't stopping when it finds the match. I tried exiting the loop, but it still doesn't work.
Basically, what I'm doing is navigating to a website with a backgroundworker.In the WebBrowser1_DocumentCompleted event, I put code to fill in a form and I set the value of a boolean called "formFinished" to true once the form has been finished and submitted. The problem I'm having is that it only posts data to the second website, no matter the order of the websites. I'm wondering how this is possible since I have a boolean in state which only gets set to true once the first form has been submitted. So I have no clue as to why it only submits the second one, but not the first one.
[Code]...
I'm using a DO interation to loop a function I'm using to test for internet connectivity. The code is working fine, except that when one of the tests is satisfied the loop stops. I want this to continue in the background while the program is running. How can I get this to work?
Private Sub checkInternet()
Dim InetChecker As Boolean
InetChecker = CheckForInternetConnection()
Do While LabelCount.Text <> ""
Thread.Sleep(10)
[Code] .....
Im currently making a tower defense game and im on my last bug for the game and i cannot get it solved. For some reason my For Loop to check if a shot hits a person is not working properly. Ill set it to "For Me.x = 1 To NumOfFaces 'Const for 5' and itll only check the first enemy and last enemy. Here is the code to check for if a shot hits an enemy, this runs on a timer through out the game.
Private Sub HitFace()
For Me.x = 1 To NumOfFaces
If Shot1Firing = True Or Shot2Firing = True Or Shot3Firing = True Or Shot4Firing = True Or Shot5Firing = True Or Shot6Firing = True Then[code].....
Is there a way to start same Thread form foreach loop
Sub
For Each lvItem As ListViewItem In _ListView.SelectedItems
tThread = New Thread(AddressOf Me.myFunction())
[Code]....
In my case, when i select one item from list it is working fine...but when i select more than one files it odes not work.
I'm using loop to read data from sql and then make some calculations then save it again to another table but when application loop for 3 or 4 times it's freeze but the job is done but if loop = 10 or more then it is freeze and hangup for long time .i need to learn how to make my application working better and never freeze and make application working with any count for loop without freeze .
View 7 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]...
From the below code i cant run the project how can i do[code]... ?
View 2 RepliesHow i can calculate the distance between two coordinates[code]...
View 6 RepliesI am working on an application where i need to get the road distance between 2 UK addresses.Currently im just using a web object that links to google maps so the user can find the distance themselves and then copy and paste the result into a textbox however i want a way for this to be done automatically
View 5 Replies