Cannot Get Calculations Correct
Aug 7, 2011
I am doing homework, but i've done the work already. My Issue is, I cannot get my program to compile the calculations for the payments properly. Maybe I'm just too tired to see it, but It should be working from my view. Here is what i have so far...
Module MortageCalculatorWK5
'Loan Amount Input
Dim LoanAmount As Decimal = 200000
[Code].....
View 12 Replies
ADVERTISEMENT
Dec 5, 2009
I am unable to get the correct calculations out of my variables. If I input say fgh2 and enter 5 for monthly sales everything displays fine. enter fbd2 and 5 for monthly sales again everything is fine I get a result of 10 but as soon as I deviate from that formula like ftp1 and 3 in the monthly sales textbox it comes back as 13 in the newCarLabel when it should be 3
Option Explicit On
Option Strict On
Option Infer Off
Public Class MainForm
'global variables
[Code]...
View 1 Replies
May 15, 2010
Is it correct to correct properties values on the fly? for example: (note the .ToLower)
Public Property X() As String
Get
Return _x.ToLower
End Get
[code]....
View 1 Replies
Jun 8, 2010
i'm working on a system that upgrades a basic version to a proversion but i have a payment gateway . it generates a code in an SQL DB.now i have a form in VB that has a textbox and a button how can i let VB connect to my SQL DB receive the code and then check if that code is correct and if its correct download silence the pro file. from an url.
View 7 Replies
Apr 18, 2009
I have created a basic query generator which allows a user to select the Select, WHERE and criteria attributes using a number of checkboxes.However i have got stuck. In the results form i have the following code
Private Sub DisplayRecord()
RichTextBox1.Text = ds.Tables("newResults").Rows(intCurrentRecord).Item(0)
RichTextBox2.Text = ds.Tables("newResults").Rows(intCurrentRecord).Item(1)
RichTextBox3.Text = ds.Tables("newResults").Rows(intCurrentRecord).Item(2)
[code]....
The program keeps on crashing if the user does not select the corresponding amount of display records from above for the amount of attributes they want for the SELECT part of the query in the intreface in form 1.
How would i go about making something where the number of SELECT attributes selected which are listed in a string create the correct number of textbox fields in the results form (form2)
View 1 Replies
Sep 18, 2007
I have a DataGridView which displays info from a Database. I need a couple of the columns to be able to do basic calculations such as +, - etc - nothing more complicated really. I am a bit stuck as to how to gte this working.I have tried the code below with no joy:[code...]
View 7 Replies
Jun 6, 2011
I'm very new to programing and am having problems trying to perform some calculations with a list. I have read in an array into a list with a count attached to each item example: "xxxxxx(intcount)". What I'm trying to do it use two xxxxxx(intcount)'s at xxxxxx(intcount+5) and xxxxxx(intcount+25) and use these two variables to calculate yyyyyy(intcount) but it isn't working. I understand this may be a stupid question but could someone please point me in the right direction.
View 6 Replies
Jun 11, 2012
I'm developing an app in which there's hundreds of different calculations involved and would like for my app's admins to be able to tweak these calculations by specifying the formulas.For example, my database table contains price and quantity. One of the columns 'X' might contain "(price * quantity) over the past 7 days". How can I allow my app's admins to change the calculation from "7 days" to "14 days"?
Is there some way to make calculations dynamic within VB.NET or do I have to rely on stored procedures and write some code to alter those procedure if a change is needed? What are the best practices in this type of a scenario?Ideally, I would like to use something similar to the "Tags" box used when posting questions on here to bring up the available fields and add mathematical operators in between them to perform calculations. It might be adding more complexity, but would be great if an existing calculation isn't overwritten so that it could be used in building a new formula.
View 2 Replies
Feb 28, 2009
i used this code to assign the brand dbs to a value of 200
[code]Private Sub xModelComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xModelComboBox.SelectedIndexChanged
If xModelComboBox.Text = "DBS" Then
[code].....
View 5 Replies
Sep 10, 2009
I have to use some calculations now and then and sometimes those will give me inf, and sometimes they work, this makes my app very inaccurate...Now i dont know what is causing this, im not dividing zero so far i can see..
(3 + Math.Sqrt(5)) ^ ...
It works for single numbers, But how would i retrieve the ?double? of bigger numbers without getting INF?With bigger numbers i mean really big, like 1477014138.
View 9 Replies
Jan 27, 2010
i want to add calculations in 1 private function I have a textbox named lbldisplay.text when i enter a number.. the number is shown as a string so.. -private number1 as string when i press the button "+", "*", "-", or "/" the number1 must return into a double. So the number in the textbox is now a double.. so for example i press the + button, and i need to fill in a new number.. but this new number is also a string!
[Code]...
View 2 Replies
Apr 17, 2012
I cannot figure out why my calculation is not working. I am doing for 1 to 12 and it gives me 12 inputs but counts my entries as 13? What am I missing. If I change it to 0 to 11 same thing. I am not sure what the issue is, but I cannot see it, and am not sure where to look.I need to end up with 12 cycles through and intEntries to be 12.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'initialize accumulator
Dim decEntries As Decimal[code].......
View 1 Replies
Mar 28, 2011
As part of an assignment, I need to add numbers which are displayed in a rich text box. The numbers are read from a text box. The user needs to be able to input the numbers as many times as possible. Since, the numbers all come from the same text box, I am unsure how to retain the old information and add the new information to it.Since I am not really able to make my point clear, I attach this picture: RTB.PNGAs you can see, I also have a problem with the heading repeating itself. Is there a way of forcing it to only appear the first time?Here is the
Private Sub AddMoreItemsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddMoreItemsToolStripMenuItem.Click
'Retrieve number from textboxes
[code].....
View 5 Replies
Jun 3, 2011
I got a program I am working on. It does some calculations using quantity and price in such. Heres the calculation module.
Private Sub calculations()
If AdultsizeRadioButton1.Checked = True Then
adulttotaldecimal = quantityinteger * adultpricedecimal * hoursinteger
ElseIf ChildsizeRadioButton2.Checked = True Then
childtotaldecimal = quantityinteger * childpricedecimal * hoursinteger
[Code] .....
Ok, everything has worked when I display the information.... up until the accumprofitdecimal variable. When i display that value its NOT what it should be. For instance i'm putting in a quanity of 1 and an hour of 1 for an adult then for a child, the extended price comes out properly as $2.15 now the code accumprofitdecimal += extendedpricedecimal SHOULD add the extended price (2.15) to the accumulative total. but when i display the accum profit total it shows a number that makes zero sense... is accumprofitdecimal += extendedpricedecimal not correct code?
View 3 Replies
Jul 14, 2011
I have an older program that I wrote some time ago in VB then late updated for VB.Net. The program calculates the ephemerides of comets based on orbital elements downloaded from the Minor Planet Center website. I am now trying to make an iPhone/iPad application using the same idea and the same calculations. Unfortunately I am too new at objective-c that trying to convert the extensive calculations is proving quite difficult for me.
[Code]...
View 1 Replies
Jul 17, 2010
Trying to figure out how to calculate factorials via loops. Cant seem to figure out where to start when using loops.
View 9 Replies
Mar 27, 2009
I am doing a diet program in VB.net and I have 3 forms which have food and drinks as text boxes which can be selected by the user! I have coded them to be sent to list boxes on another form called 'results'. How can I set it up so what is selected on each form is added to a list box then adds up the calories etc. form what the user selects. I have made a calculate total button to add whats in the list boxes and I need to show the results to the user! How would I go about coding how to do this?
View 6 Replies
Jul 10, 2010
I was working with a calculator i made.. and then i was thinking of making all my calculations to be displayed in the listbox..Here is my program for the calculator..
Public Class Form2
Dim Nm1, Nm2, nnn As Long
Dim Opr As String
Dim FF As Boolean = False
[code]....
View 2 Replies
Jan 23, 2010
i have two date time values (dd/mm/yyyy) <== This comes from the database the second one come from the NOW function in VB, also in the form of (dd/mm/yyyy) how do i compare the two values to find the difference in the time, eg (1 day and 4 hours)
View 3 Replies
Jan 26, 2012
I have a datagridview which as several rows read from an access database which I can not alter. Column 4 of each row shows the date of the last service call. I would like to have a calculated column showing the difference in days between the date in Row1 and the date in row 2, the date in row 2 and the date row 3 etc.. I have exported the datagridview to excel and have set the calculated column it works ok, but is is possible to do this from within VB datagridview
View 7 Replies
May 3, 2011
' I will declare some variables and constants ' these will be declared globally
Dim dblCost As Double
Const dblHANDLING_STRESS As Double = 595
Const dblSTRESS_DAYS As Double = 3
Const dblTIME As Double = 695
[code].....
My program needs a loop for calculation of items added to the listbox.
View 4 Replies
Jul 22, 2011
Im creating an application that allows me to enter a product with a cost. I want all the costs to be saved in an array and then calculate the total cost and display it in a label. I looked for hours in my textbook and cant seem to get this part.
[Code]...
View 3 Replies
Nov 18, 2010
I need a little guidance in the right direction to help with using data from a dataset in calculations. I've watched the "How Do I" Series and it was very helpful in setting up the relations and tables. I have setup a couple tables to hold values that won't
be updated and the user will never see. Lets say I have 5 columns, ColmnA to ColumnE, and the row count is variable. What I can't seem to find is an easy way to loop through using the variables. As an example, Lets say the equation would be outputted to a
textbox:
textbox1.text=row1(ColumnA*ColumnB+ColumnC^ColumnD-ColumnE)+row2(ColumnA*ColumnB+ColumnC^ColumnD-ColumnE)+etc to end of rowcount
Does anyone know if a good tutorial to point me in the right direction or a code snippet that may get me started to follow the logic? I'm using VS2010Express with a SQLExpress database if that helps.
View 8 Replies
Feb 4, 2011
I am working in Visual Basic 2010 Express and have a table with 3 columns created using a SQL dataset called 'test' if you like.The table columns are called A B and C If someone enters a value of 10 in A and 15 in B, is it possible for column C to automatically add them up and come up with 25? - if so how do I start?The above is only a simple example of the problem I have, but once on the right track I am sure I can apply the same logic to the table I actually have?
View 14 Replies
Jan 2, 2012
I have some code where I am trying to use variables in a tabpage. The first tabpage only has one text box for user entry (miles.text) and a button to do a calculation: traveltime = mileage/speed. The value from miles.text is stored into a variable called mileage while the speed used is stored in a variable called speed (me.speedtextbox.text).
Ordinarily, doing val(variable.text) works like a charm and it's not doing it in this case. When the user enters 100 for the mileage, it should be divided by 65 (the number in the database) and, therefore, the answer should be 1.53 hours. In my case, I'm getting "infinity" and whenever I do anything else with the variable, I get "when casting from a number, the value must be a number less than infinity." But it is! It's only 65 and I double-checked that the dataset said that too, which it does. Not sure why I am getting this error.
[Code]...
View 3 Replies
Apr 13, 2012
OK, so my accumulator is now adding and showing properly in the form as a total. However, something is wrong in my if... then statement and it's not throwing it to the 2nd level after reaching the 125.*Edit to show updated with the Do While Loop. Now causing issues with my input error msgbox... *
do while decTotalCredits < 125
If IsNumeric(txtCredit.Text) Then
' This statement will convert the string entered to decimal and establish the
[code].....
View 1 Replies
Apr 6, 2011
got a project from college to create a program for a car company that will provide quote for the loan the client requires to purchase a car. I've created a file which adds,deletes,edits,views all, and a administration section. I need to add the calculations to actually work the quote out. Can either use a case construct or an 2 dimensional array but don't know how i'll do it. Using console application by the way.
[Code]...
View 3 Replies
Jun 5, 2011
Am a student novices in vb.net. But task to vb.net for school project. I want a code to help me add a No fo Months(this is an integer) from date and the result display in a tet box as a date. I have 2 fields: Months and startdate, the third which enddate get focus, the system the enddate. eg 6 months to make a payments, the payment start from 01-02-2011. i want small code which would determine the enddate of the payment period. or the month/year of thee repayment period
View 11 Replies
Sep 13, 2009
I am having trouble creating a console application with these specifications:
* Declare variables named HoursWorked, HourlyRate, GrossPay, and NetPay, each having a data type of Double.
* Read values for the hours worked and hourly rate.
* Write the statements to multiply the hours worked by the hourly rate to calculate the gross pay. Calculate the net pay by multiplying the gross pay by 0.80.
* Display the gross pay and net pay (formatted for currency).
This is what I have so far:
Sub Main()
Dim HoursWorked As Double
Dim HourlyRate As Double
Dim GrossPay As Double
[code]....
I don't exactly understand what it means to "read the values for hours worked and hourly rate". Does it have something to do with "Read Line"?
View 4 Replies
Nov 19, 2010
All - I have a form that has two databound textboxes on it. To keep it simple, they are: Quantity & Value For BOTH of these text boxes, the TEXTCHANGED action will multiply the two and present the result in a LABEL. This works 100%.
[Code]...
View 7 Replies