Hi everybody,
I have following code:
Public Class Form1

Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click

Dim dayChange As Date = dtp2.Value
Dim answer As Date
answer = dayChange.AddDays(1)
dtp2.Value = answer

End Sub
End Class

Working : each time I click btn1 datetimepicker changes to date +1(adds one day)
dtp2 is my DateTimePicker
Problem: I need the date thats changed to stay when the form is opened next time
Eg: dtp2 is set to 19.04.2008, I clicked 4 times and have in dtp2 23.04.2008
so when I open the form dtp2 will show me last selected date (23.04.2008)
I have some calculation to perform each day. How can I keep track of last 7 days calculations.
Eg: On 19.04.08 I calculated sum to 124, next day 23, .......
I need total of sum for last 7 days, as dtp2 is updated on daily base.
Tks GaGa
PS
Who ever gives me best answer I will borrow him my pensioners card for 2 days.

Recommended Answers

All 7 Replies

You could store the data in a database, XML files or just you the My.Settings area


The My.Settings area is setup from the "My Project" List and it is a left side tab called Settings

The My.Settings is good for quick data stores that have a fixed size (one record for each day & 7 days)

Or use a DataTable and the lines DataTable.ReadXML & DataTable.WriteXML

Hi Peter,
Thanks for replay, its bit advanced for me.
I will try to solve the problem with function and counter.
Eg: Function where for each day I will have sum and than other function with counter that looks in last 7 days.
Any sugestions are welcome.
Thanks GaGa

maybe using text file to save setting...

I'm trying following:

I have lets say 6 checkBoxes in groupbox (gpb1) if I tick 4 I have total of 4 in my listbox

Dim intCounter As Integer = 0
        Dim chkAll As CheckBox
        For Each chkAll In gpb1.Controls
            If chkAll.Checked = True Then
                intCounter = intCounter + 1
            End If
        Next
        lbl2.Text = CStr(intCounter)

I have btn1 where I change my date to next one, I have put dtp2(DAteTimePicker in gpb2 (GroupBox):

Dim dayChange As Date = dtp2.Value
Dim answer As Date
answer = dayChange.AddDays(1)
dtp2.Value = answer

I'm trying (without succes) with For Each loop to get for each new date to have total of checked checkBoxes, and then sum of 7 last days
Thanks GaGa

Hi again,
How can I get continued total for chkBoxes each time I click btn1.
Eg. If I check 2 boxes then btn1 lb2l will show 2, then I check 4 chkBoxes , btn1 and lbl2 will display 6 ?
Thanks GaGa

Hi all,
I have found solution,
difference days detween dpt1 and dpt2 will be counter, and with that I can solve sum of added chkboxes.
Thanks all for yr effort.
GaGa

i store value of date time picker into the database how i can do that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.