Any idea on how to Add dates based on the number inside the data tables?

for example I set the limit of Days of books for borrwing it
then i set the amount of fine that will generate if the the borrowed books is not returned

IE:

DateNow * Value of Set Days(tblSettings "Dayskept")

DateReturned + Value of Set Fines(tblSettings "SetFines")

I really have no idea how to use the data inside in the DataGridView
for adding it or multiply.

You could put the due date in one column then calculate the DATEDIFF in days from today. Multiply that by the fine per day. If the result is negative or zero then the book is not overdue and the fine is zero.

fine = finerate * Math.Max(0.0, DateDiff(DateInterval.Day, duedate, Now))

This statement calculates the number of days between now and the due date. Math.Max ensures that negative values (book is not yet overdue) are replaced with zero. That number is multiplied by the daily fine rate to give the fine owing.

Wait, what if the Finerate is inside the Column SetFines?

and the do you know if the fine would start calculating if the DateReturned is over the limit of the DateBorrowed??

You don't need to put the finerate in a column because the value doesn't change from row to row. It is a constant. The equation I gave returns the actual fine if the book is past due and zero if it is not.

im a little bit confused here.

i dont have to save the settings in a table just to set the Finerate and the DaysRentRate? to do this?

im a little bit confused here.

i dont have to save the settings in a table just to set the Finerate and the DaysRentRate? to do this?

How will the program remember the settings?

There are a number of ways to save values between sessions

  1. save the value in a database
  2. save the value in a file
  3. save the value in a My.Settings variable

For a single value the easiest is probably the last method. Go to the project properties page and click the "Settings" vertical tab. Enter the following for the fields

Name:   finerate (or another name of your choice)
Type:   single
Scope:  Application
Value:  1.50 (or whatever your daily rate is)

In your Form Load event handler you get the value by

finerate = My.Settings.finerate

If at any point you change this value you can save it back to My.Settings by

My.Settings.finerate = finerate

Hey man i saved the Values for the DayRate and the FineRate on .txt file....Now i want to know how to open those file to get the saved values inside that txt file for adding days and setting fines for the transaction process

Use My.Settings. It's a lot easier. Instead of all that file I/O and wondering where the file is (or if it's been moved or deleted or in the wrong format) you basically just read/write a variable.

I tried it what i did is i put two settings for FineRate and DayRate

then i have two textboxes for saving or Updating a new Settings
i tried connecting the textboxes properties on Application Settings and i cant find it.

On form load you can do

txtDayRate.Text = My.Settings.Dayrate

If the value changes you can save it back as

My.Settings.DayRate = txtDayRate.Text

i got some blue underline error saying that

Property FineRate is 'ReadOnly'

Property DayRate is 'ReadOnly'

This question has already been answered. Start a new discussion instead.