Dividing Currency By An X Amount Of Months?
Feb 16, 2012
im trying to learn how to made stuff with currency.For example:I divide 10.000$ by 12 Months, rounding with 2 decimals i have 833,33 $.If i multiply 833,33 $ * 12 i got 9999,96 $, so there is 0.04 of possible loss.
Rounding the 9999.96 with 2 decimals of presition i got 10.000 $ but that's what i don't want since 0.04 is a loss.Im using SQL Compact 4.0 as database, the price_month table is decimal(18,2)
Here is my code:
Dim price as Decimal = 10000
Dim pricemonth as Decimal = Math.round((price/12),2) ' 833.33
Console.Writeline(pricemonth*12) ' 9999.96
Console.Writeline(Math.round((pricemonth*12),2)) ' 10000
View 1 Replies
ADVERTISEMENT
Jun 29, 2011
I have two dates, a creation date and an expiry date. I want to find out how many years and months (not days unless it is only days) between them.
I've got two dates:
Dim start_time = "12.5.2011"
Dim end_time = "15.11.2014"
I want it to say (3 Years, 6 Months) etc
View 4 Replies
Feb 2, 2010
i have a list with dollar amounts that are strings. there are 8 separate dollar amount fields. amt1, amt2, amt3, amt4, amt5, amt6, amt7, amt8. i want to find out which amount is the largest. how would i convert each string amount to currency? i was thinking something like this:
Decimal.Parse(row("AMT1"))
the string is in this format:
$1,000.00
View 9 Replies
Oct 20, 2010
I have made a new form on vb 2010. I need a small box which updates itself automatically to show the amount of years,months,days,hours,minutes and seconds from the 25/6/09. How would i do this in visual basic 2010?
View 3 Replies
May 23, 2012
With Vb.Net, How to get dates older than 3 months and less than 6 months ?
View 3 Replies
Apr 24, 2011
I am trying to create a currency converter that will convert currency. I have a text box to enter the amount and 2 combo boxes to choose which currency you are converting from and to.
I am using a webservice site XML that contains the conversions.
The problem is I cannot get the display to work properly.
View 4 Replies
Jan 21, 2010
i have a datagridview binded with the datatable via its datasource property....now i want to add the Amount column of the dgv and display the total amount in the textbox,if the amount is greater than a certain value then i want the cell to coloured red so i did this code and it worked great:
Dim i, j As Integer
For i = 0 To DataGridView1.RowCount - 1
j += Me.DataGridView1.Rows(i).Cells("Amount").Value
Next
[code]....
but my problem is that i want the red colour of the cell to blinkafter every 2 seconds....how to do this?i need to handle the timer tick event for this but i am not able to do this.....
View 2 Replies
May 4, 2010
im trying to make a simple program that calculates the time it takes to cover x amount off nautical miles at x amount off knots, the code i have so far is this :
Code:Public Class Form1 Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
[Code]...
so if i say want to cruise 29 miles at 12 knts it gives me an awnser of 2 hours 24.6 mins instead of 2 hours 25. Although i do realise that 2 hrs 24.6 is technicaly right i was wondering if anyone here could help me with getting it into the correct format?
View 4 Replies
Jun 7, 2011
im trying to make a fast food program on which the user will input the amount that he has, then he will check on what he wants, by using check boxes. There are 7 different check boxes with 7 different amounts of money. I have the program somewhat finished (thanks for the people that helped me before) but theres still a couple of things that I still need to get finished but I dont know how to.I need to be able to get how much money the user has (this will be entered threw a text box, I think I accidentally messed this part up, because I cant get it to work right, (theres alreasy a permit amount of money in there and it needs to be what the user enters instead of the permit, 5.59, one) and this will be the maximum amount he can spend, then the user will check on the food he wants (and the program will add the sales tax also) then it will produce an answer saying if you have enough money or if you dont. But what im confused on is how do I get the users amount of money and make it the maximum mount he can spend and make sure it doesnt go over the amount that he has checked.[code]
View 1 Replies
Nov 25, 2009
I am working in a point of sale system in Vb express 2008. I want to convert the Amount in Figures to Words like: How to conver the amount of $ 1,550,325.45 to Amount in words as DOLLARS: ONE MILLION, FIVE HUNDRED FIFTY THOUSAND, THREE HUNDRED TWENTY FIVE AND FORTY FIVE CENTS.
View 2 Replies
Nov 25, 2009
I am working in a point of sale system in Vb express 2008.I want to convert the Amount in Figures to Words like:How to conver the amount of $ 1,550,325.45 to Amount in words as DOLLARS: ONE MILLION, FIVE HUNDRED FIFTY THOUSAND, THREE HUNDRED TWENTY FIVE AND FORTY FIVE CENTS.Please advise how to code for that in Vb express.
View 5 Replies
Jul 12, 2010
I want to divide a form into 2. Side a I want buttons. Side b I want a form to display certain info.
Example: Button on side a (Add Employee). If a user click this button, on side b is info about adding a new employee.
View 4 Replies
Aug 3, 2011
I have a fairly small double and a fairly large double. When I divide the large one by the small one and display it with Console.WriteLine, it always shows exponential notation. Can I display the non exponential notation form?
View 2 Replies
Mar 13, 2011
how to calculate the amount needed to save up to a certain amount.
Private Sub btnCalc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim dblSavings As Double
Dim dblFuture As Double
[code]....
View 3 Replies
Nov 19, 2009
How easy it is to "split" a bitmap into separate parts?Here is a bitmap that was generated by a program - the red pixels that you see are purely red, there are no other colours.I want to know if the left side is "redder" than the right side. (Actually I want to be more precise than that (but I can figure that out on my own))So, I think that "splitting" the bitmap up into sections like this: would be the best way to do it then I can count the red pixels in each section.Here is the part of the code snippet that produced the bitmap you see above:I think I might be able to modify this easily to count pixels, if I know how to split the bitmap into section thingies.
Dim are_identical As Boolean = True
Dim eq_color As Color = Color.White
Dim ne_color As Color = Color.Red
For x As Integer = 0 To wid - 1
[code]....
View 5 Replies
Jan 15, 2012
I have 3 combo boxes on my form
1. Doctor Start Time
2. Doctor End Time
3. Doctor Appointment Duration
I want a 4th combo Box that will Start from Doctor's Start Time upto Doctor's End Time with the interval of Appointment Duration eg. Suppose the Start time is 08:00 and End Time 10:00 with 24 hr clock the appointment duration is 30 mins then the 4th comboBox should Display
08:00
08:30
09:00
09:30
I have done this coding on the basis of Appointment Duration
Dim da As DateTime = FormatDateTime("00:00")
cboAppTime.Items.Clear()
If txtDuration.Text = "15" Then
[code].....
The above coding shows time from 00:00 to 23:00
View 4 Replies
Aug 17, 2009
i am controlling the hue and saturation of the backcolor of the form with scrollbars:
Private Sub tbHUE_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbHue.Scroll
Dim r, g, b As Integer
HSVtoRGB(r, g, b, tbHue.Value, tbSaturation.Value / 50, 255)
[code]....
i would like to know what is the purpose of dividing by 50?
View 3 Replies
Apr 4, 2012
I've came across to quite an unusual problem with dividing integers with double variable. I've created For loop where to sum-integer interval -double is added. When sum reaches certain number text is displayed as showed below:
[Code]...
View 10 Replies
Dec 1, 2011
I was wondering how I can make textbox1 get divided by textbox2 at the click of button1. The number will go into textbox 3. I was also wondering how I can make the number round up or down. I also want all three text boxes to only accept numbers.show me the code in an easy to read format.
View 2 Replies
Aug 10, 2011
I've read a lot of different questions on SO about multithreaded applications and how to split work up between them, but none really seem to fit what I need for this. Here's how my program currently basically works:
Module Module1
'string X declared out here
Sub Main()
[Code]....
This is only a rough outline of what actually happens in my code by the way.
My problem being that if multiple threads start running Main2(), they're dealing with the same X value as in the other threads. The loop inside of main2 executes multiple times per millisecond, so I can't just stagger the loops. There is often duplication of work done.
How can I properly divide up the work so that the two threads running simultaneously never have the same work to run?
View 3 Replies
Jan 11, 2011
I'm stuck on a simple problem maybe you can help!
Why does this work
vb Private Function calcArea() As Decimal
Dim height As Decimal
Dim width As Decimal
' assigns user input from the two text boxes to the two variables
Decimal.TryParse(heightTextBox.Text, height)
Decimal.TryParse(widthTextBox.Text, width)
[Code]...
All I did is change the multiply symbol to a divide symbol and now when I try to divide the two Decimal variables Visual Studio says, "Option strict on disallows conversions from 'Decimal' to 'Long'." Not sure where this conversion is happening.I know I'm missing something simple (once again) so if anyone has any advice please let me know.
View 3 Replies
May 12, 2011
I'm trying to make a program that uses Ohms circle to calculate varying data regarding electricity, I think that if you look at my code you'll get a good idea. The problem that I'm having is that I'm using On Error Resume Next so the program will automatically find the valid calculation to calculate the value for the variable, but what's happening is that when it divides by zero (the default value for variables with no value) it gets Infinity, which it has decided IS a value, but I don't want it to be, I need a runtime error so it will bypass that calculation and go on to the next one.
'Skip erroneous statements and continue on to next line of valid code
On Error Resume Next
'--------------------------
'VARIABLES
'--------------------------
'v = voltage
[Code] .....
View 9 Replies
Feb 22, 2010
I have a stopwatch in my program. I start the stopwatch with the start button I created. When I stop it it gives the results of the time in a label that I have named labelTime. I have a Calculate button I have created. I also have a label I have named calcResult. I want to click the Calculate button and divide the stopwatch result (labelTime) by 60. I want the results of this calculation to be displayed in the label calcResult. I keep getting errors saying labelTime is a string value. I believe I will need my calcResult to be a Decimal.
View 20 Replies
May 31, 2011
What is the proper way of working with percentages and DataGridView and dividing by zero..In my code I am attempting to divide two numbers, sometimes one of the numbers is zero..Then I need to add a column to my datagrid, I think i need it to be decimal? So i can sort it later. I had it as a string and everything worked fine excpet i couldnt sort properly.[code]If I change column to Double it handles it fine, then i am not sure how to read the value as a percentage?
View 12 Replies
Jul 30, 2009
I'm trying to do this division and the result to be displayed on a eight decimal number.
Dim r1 As Integer
Dim r2 As Double
r1 = Val(TextBox16.Text)
r2 = r1 / 60
TextBox18.Text = FormatNumber(r2, 8)
The value or R1 on this case is 273.4 but it varies according with the result obtained so I can not allocate a constant number to r1. The problem is the result that I am getting is 4,55000000 instead of 4.5566666
View 2 Replies
Jun 2, 2011
I'm developing a loan mng't system wherein the starting application of the customer say for example today.06/08/2011, the initial payment will be on 08/08/2011.. how am i going to that do on sql server 2005?
View 6 Replies
Jan 27, 2010
First of all i'd like to say thankyou for my last couple of threads as i've found useful ways to make my application great.
Now this is more of an extra credit function more than a necessity.
So for example if the date I currently have is 30/01/2010 how could I make that 30/02/2010? I want the program to add it on for each calandar month, if it's easier for every 4 weeks then that's fine. So is there a way to add to the "Now" function?
View 2 Replies
Jul 13, 2010
I want to get the name of months base on the datediff result. What i've done is that i determine first the number of months in datediff function
Datediff(Months, "13/07/2010", "13/03/2011")
The result of that is 8. Since 8 is the result i want to convert that into months witch supposed to be:
[Code]...
View 3 Replies
Jan 9, 2011
How to calculate the difference in months between two dates in C#? Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. The documentation says that I can use TimeSpan like:
[Code]...
but this gives me data in Days. I don't want to divide this number by 30 because not every month is 30 days and since the two operand values are quite apart from each other, I am afraid dividing by 30 might give me a wrong value.
View 8 Replies
Sep 30, 2006
When you open a MonthCalendar control at runtime, and click on the top Month designator, it takes you to a list of all 12 months in order to jump back or forward to a desired month quickly.
My question is, can I restrict the user to only viewing this 12-month calendar at start-up, so that I can just read the Month the user wants to say run a report from.
I realize I could use just a DropDown, or list box with the 12 month names in it, but since the control has this ability to view by month, I figured I would ask.
It would also allow me to reuse a control that I also use to pick a specific date, keeping my code a bit more compact on filesize, and save the control space for a new Combobox or something.
View 1 Replies