Loop Statement - Display A Table Giving The Balance On The Loan At The End Of Each Month

May 17, 2010

I am trying to create a program in vbfor this problem: "A TV set is purchased with a loan of $563 to be paid off with 5 monthly payments of $116. The interest rate is 1 percent month. Display a table giving the balance on the loan at the end of each month". It must have 1 button and a list box that displays successive balances, contains loops to balances, loop code includes output to the list box, List box displays 2 columns (one for month and one for amount owed) and 5 months are displayed and the amount owed for each. The Amount Owed should go down each month from month 1 to month 5 where month 5 will equal to $0.00

Here is my code so far but somehow the 1 percent interest i cannot get to add on each month so I am not getting the write answer.

Code:
Dim rate As Decimal
Dim loan As Double
Dim pay As Double

[CODE]...

I have attached a jpeg of what the end result should look like when code is being run.

View 3 Replies


ADVERTISEMENT

VB Code For Diminishing Loan Balance?

Mar 3, 2011

Here is the problem. I am to write a VB program that will take a Loan of $563 that is to be paid off with 5 monthly payments of $116. The interest Rate is 1% per month. I need to display a table giving the number of months and the balance on the loan after each month.The Table displayed should look like this:

Month Amount Owed
1 $452.63
2 $341.16
3 $228.57
4 $114.86
5 $0.00

Here is my code but I do not understand why it only shows "Month" and "Amount Owed" and nothing else.Maybe someone can point me in the right direction and I can figure it out.

[Code]...

View 4 Replies

Stop A Loop Statement In VB And Not Perform Display Changes Until After Call Procedure Is Valid And Complete?

Apr 19, 2010

I am having problem with the coding of this (endless loop) and formatting of summary boxes before tests are complete that should not happen. (the overall goals is to have a separate validation procedure that does not calculate or dat displays are not performed until after call function is complete and valid. The validation that takes place are that two boxes are filled in - one is text and the other is a numeric value. (using vb 2008)

[Code]...

View 10 Replies

Add A New Student Loan And The Program Checks The Book Title If Loan Exists?

Feb 11, 2012

What I want to do is to add a new student loan and the program checks the book title if loan exists, does not allow the same loan to be created. There is no limit on the number of loan placed by the student. How do I write the code as above in VB.NET Note: 1 book Per Loan number Add Loan Form

View 1 Replies

How To Update SQLServer Database Table Balance Column

Mar 26, 2011

I'm maintaining a Table in SQLserver, the Table contains Transaction of Cash In (Debit) and Cash Out (Credit) as follows:

Table Name : "BankLedger"
DATE...DETAILS........DEBIT...CREDIT...BALANCE
1/1/11.Opening Balance.................5000
1/1/11.Rent payment...........2500.....
2/1/11.Mobile Bill.............500.....
3/1/11.Monthly Share...5000............
6/1/11.Emp Salary.............3000.....

Now my requirement is how to update the Balance column respectively same as "Running Total" method???

DATE....DETAILS........DEBIT...CREDIT..BALANCE
1/1/11..Opening Balance................5000
1/1/11..Rent payment...........2500....2500
2/1/11..Mobile Bill.............500....2000
3/1/11..Monthly Share...5000...........7000
6/1/11..Emp Salary.............3000....4000

My application in Visual Basic 2010 and Database SQLserver 2008.

View 3 Replies

Create A Program That Asks For Input Then Uses An Else Statement To Create A Handling Fee Balance

Nov 30, 2011

To create a program that asks for input then uses an else statement to create a handling fee balance.

Input: sales record - first name, last name, purchase amount, balance before purchase

Output: report - full name, old balance, purchase amount, handling fee, new balance

Definitions: handling fee is 5% of the old balance if the old balance is less than $1000.00 else it is 2% new balance = old balance + purchase + handling fee

Processing:
Ask for and receive sales information
Calculate new balance
Print output report
End the program when a purchase amount of 9999.99 is entered

View 3 Replies

Asp.net Mvc - For Each Loop LINQ Insert Giving Cannot Add An Entity That Already Exists?

Mar 11, 2010

I have the following code, that in my head should create a new row in a table:

Dim fin As Boolean
Dim db2 As New ChecklistModeldbmlDataContext
For Each a In bServers

If collection("fin" & a.ServerName) = "true, false" Or collection("fin" & a.ServerName) = "true,false" Then

[Code]...

It only ever adds one record in to the table and then errors with Cannot add an entity that already exists.

Now it should enter 4 rows into the table, but I can't work out why the above gives me that error.

I've also tried having the db2.SubmitChanges() outside of the for each and it just inserts the last row.

View 4 Replies

Making A Next Statement Into A Loop Statement In Visual Basic?

Jun 8, 2009

y friend and I are re-learning Visual Basic, and we are stumped on this bit of code.

For intAsterisks As Integer = 0 To intLine - 1
lblAsterisks.Text = lblAsterisks.Text + "*"
Next

View 6 Replies

Take Opening Balance When Open A Report Between Date Parameter It Show The Opening Balance

Apr 21, 2011

I want to take opening balance when i open a report between date parameter it show the opening balance, actually i have three columns "description" "debit" "credit" in crystal report now i want to add 1 more field which come throuhd formula which is opening balance. i have a data of debit credit from 2006. but user choose to show the data from 2008 so i want that the balcne from sum of debit and credit side between 2006 to 2007 end come in the shape of opening balance in the report and then add the debit and credit side of report into opening balance. i put a following fromual bt not accept it sum ({vr_detail.debitT})-sum({vr_detail.creditT}) > {?strtdte}

View 1 Replies

Sql Statement To Select Month Part Of A Date?

Jun 11, 2011

designing an inventory system and i want to generate crystal reports from sql queries.Actually want to generate monthly and yearly reports from the daily sales reports i have populated

View 4 Replies

Change Date Format - Month Part Is Not Showing The Month Of The Exact Month

Jun 22, 2009

I changed the date of datetimepicker format to yyyy-mm-dd in custom format...but it displays 2009-00-22...the month part is not showing the month of the exact month..how to change the format of the date?

View 3 Replies

.net Loop Through This Month And Past 6 Months?

Feb 2, 2012

I am trying loop though this month until past six months using vb.net and get the the month as integer and year only and pass this to my sql statement. but cannot seem to figure it out..so far i got this :

Dim dtNow As DateTime = DateTime.Now
Dim pastSixMonths As DateTime = dtNow.AddMonths(-6)
For i As Integer = dtNow.Month To pastSixMonths.Month
Next

View 1 Replies

Asp.net - Loop For Each Day In The Current Month And Check Rows For A Match?

Dec 12, 2011

How can I write a loop to run for each day in the current month and then check to see if the Dataset has a record that matches one of those days and take an action?

For Day As Integer = 1 To DaysInTheMonth
For Each row In MyRows
If row.Date.Day = Day Then[code]....

This generates too many rows in the table I have it building. Basically, every day gets as many rows as there are that contain data.I'm building a HTML table that gets mapped into a chart using jquery so I need a for everyday of the month.

View 2 Replies

Giving An Error "End Of Statement Expected" ?

Oct 22, 2011

I am programming a fairly basic Hangman program for class, and my code is fine except for this one section:

Do While numberindexint < 5 AndAlso correctwordbln = True
userwordstr.Substring(numberindexint, 1)Like "[!A-Z]" Then
correctwordbln = False[code]....

The red portion is what is giving me and error that reads "End of statement expected."

View 4 Replies

Sql Query To Select Only Month Name From Table

Sep 15, 2009

My following code is only retrives number month(1,2,3,4....12)and not month name(January,February,.....December).Before that i had try using function datepart, Monthname and date_format but i still din get my answer.[code...]

View 3 Replies

Month To Display In MonthCalendar Ctrl

Mar 15, 2009

I have a monthcalendar control which display 3 months at a single time. Now I want the first of the 3 displayed months to be the current month (running my app. the 3 month will be this month).

View 13 Replies

Check Day & Month From Date Which Is In Database Table

Jul 7, 2010

I want to check Day & month of date which is in database.There is date field is in database which is mm/dd/yyyy format If I use "select" query then whole Date is access but I want only these date's which having today's day & month.Example: if today's date is 02/02/2010 then select only those date whose day is 02 & month is February.(Dont consider Year)

View 2 Replies

Save The Day The Month And The Year To A Table From The MonthCalendar1?

Mar 23, 2009

I have a MonthCalendar1 on my form and i am trying to save the day the month ans the year to a table from the MonthCalendar1.

.Fields!ISBN.Value = txtBookIsbn.Text
.Fields!SupplierID.Value = txtSupplierID.Text
.Fields!Date.Value = MonthCalendar1.BoldedDates

[code].....

View 2 Replies

Forms :: Using An Array To Display Month Name, September Etc?

Sep 10, 2009

I am tuning my knowlegde of Date and Times, but why doesn't this work

Dim now1=DateAndTime.Now
Dim month As Integer = now1.Month
'creates an array to determine the month name

[code]....

also, using the array, I noticed after 10 entries the array was looking to close, highlighting October, November and December as errors.

View 9 Replies

Get Final Output To Display Month , Day , Year?

Dec 22, 2010

How do I get final output to display month, day, year? Would I need another replace array? Or can I dynamically format from SQL table?[code]...

View 7 Replies

VS 2005 Display All The Days With The Date Of That Month?

Apr 19, 2009

hi..how can i select a month..and display all the days with the date of that month from month calender...

View 1 Replies

VS 2010 Date Format To Display Year - Month - Day As In The Database

Dec 13, 2009

I'm using VS in Vista. I have using a DataBase in SQL2008 which its date format is year,month,day. In my app I have the date format as Format(Now, "d") which shows 13/12/2009 but when inserted it displays as 1900-01-01 in the DataBase. How can I have the date format to dispalay year,month,day as in the database.

View 10 Replies

DataGridView On A Form That Is Being Populated From A SQL Table Dataset By Giving Criteria From A Previous Form?

Apr 8, 2009

I have a DataGridView on a form that is being populated from a SQL table dataset by giving criteria from a previous form. I have 6 columns in the dataset, of which the last column should be combo box column containing items "Done" and "Pending". How do I make this bound column to a combo box column and display the value as well as the alternate item too in the combo box?

View 6 Replies

How For Each Loop Statement Actually Works

Dec 8, 2011

I am trying to understand how a for each loop works and am having some trouble. I am trying to create a program that will query a sql database, pull back the information and store it. I currently having it writing to a text file, and would like to take the information (such as name) and compare it to another list where the name is equal. However I am not exactly sure how the for each statement really works. I have looked at numerous sources and it doesn't make since to me as you can probably see from what I have put in here.

HTML
Public Class Form1
Public Sub newarrest()
Dim strsports As New System.Collections.Generic.List(Of String)
Dim employeelastname As New System.Collections.Generic.List(Of String)
Dim cnPodaci1 As New SqlConnection
[Code] .....

View 2 Replies

If Statement Or Where Extension With A For Each Loop?

Nov 18, 2009

I was wondering which of the two code samples would be more efficient (or is the difference between the two negligible)?[code]

View 4 Replies

Loop In DataRowview Using For Statement?

May 26, 2009

I am a new with using datarowview

The problem here is how to loop in dataRowview using for statement

View 5 Replies

While Loop Vs If Statement When Printing?

Jul 28, 2010

I'm practising printing, and doing fairly well - not as hard as I was thinking.

My question is: is it better/preferable to use a "while..." loop instead of an "If..then" statement when printing.

All my printing code is in various If statements (if PgNbr = 2, If PgNbr = 3 etc) but I notice in most of the examples and webpages I read that a lot of printing is done in a "while..." loop

View 4 Replies

For Loop Statement With .count Method

Dec 7, 2011

For loop statement with .count method

View 1 Replies

SyncLock Required Before If Statement Or For Loop?

Oct 2, 2009

If completedOrders.Count <> 0 Then
For i = 0 To completedOrders.Count - 1
SyncLock completedOrders
'Do some work, for example this:
Dim text As String = completedOrders(0).getCN & " " & completedOrders(0).getDeviceName & " "
End SyncLock
Next
End If
Is a synclock needed before the if statement or for loop? In other words. When you call methods like .length or .count is it necessary to synclock them or can another thread be writing to it at the same time. CompletedOrders is a generic list of a class.

View 7 Replies

VB Update SQL Statement Inside For Loop?

Jun 27, 2012

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As New Staff

[Code]....

Basically I am trying to update each record with 2 random numbers each time the button was clicked,my problem now is, the system will update the record but the data was wrong. Example, by right all data should be different (randomly string) but for some row it was updated with same data but in randomly, something row1 row2 row3 has exactly same data for column 1 and 2 then row 3 has distinct data, second time, row1 row2 same data row3 ro4 with different data. It is in random sequence. When I add a MsgBox to do testing in the For loop the data was updated correctly with all different data.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved