|
-
Sep 6th, 2010, 09:33 AM
#1
Thread Starter
Addicted Member
(SOLVED) Greetings help...
tell me the code r what can i use datapicker or timer
i would like greetings every day when the software first launch the messages show
MsgBox("it's new day again good morning sir.!")
if the date change...?
Last edited by standard; Sep 7th, 2010 at 08:37 PM.
-
Sep 6th, 2010, 06:49 PM
#2
Thread Starter
Addicted Member
-
Sep 6th, 2010, 06:52 PM
#3
Thread Starter
Addicted Member
Re: Greetings help...
can i use timer or datepicker?
-
Sep 6th, 2010, 07:48 PM
#4
Re: Greetings help...
Stop and look up what the Timer and a DateTimePicker controls do. Then you'll realize that neither of them are for what you want. Unless the program runs all night, then you might make use of a timer, but for the times when it's ran for the first time that day, neither the DateTimePicker nor the Timer would be used.
-
Sep 6th, 2010, 07:57 PM
#5
Thread Starter
Addicted Member
Re: Greetings help...
thats the question...
how to compare day yesterday and day now..
if software runs today and the date was changed the software automatic give message
MsgBox("it's new day again.!")
how to do that...
-
Sep 6th, 2010, 08:39 PM
#6
Re: Greetings help...
1. Create a field in a table and store a date
2. when app starts compare current date with date field.
3. If different, show message. then replace date field with current date.
-
Sep 7th, 2010, 04:24 AM
#7
Thread Starter
Addicted Member
Re: Greetings help...
ok number
3. is my problem..
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = Format(Date.Today)
Label2.Text = DateAdd(DateInterval.Day, -1, (Date.Today))
If Label1.Text > Label2.Text Then
MsgBox("GOOD DAY!")
End If
End Sub
3.How to replace
DateAdd(DateInterval.Day, -1, (Date.Today)) to DateAdd(DateInterval.Day, 0, (Date.Today))
Last edited by standard; Sep 7th, 2010 at 04:40 AM.
-
Sep 7th, 2010, 07:49 AM
#8
Re: Greetings help...
Ok, first thing you need to do is be sure to save the current date when the app exits, have you done that?
I would recommend using the Settings for that, in the project properties I would create a new variable of type Date. Then in the main form's FormClosing event, set the variable to DateTime.Today.
Then in the main form's Load event I would check that settings variable for not equal today (use the Not DateTime.Today.Date.Equals() ). Then inside that If block, it's only a matter of determining if it's morning, noon, afternoon or evening (or however precise you want it to be) here's an example of AM/PM:
Code:
If DateTime.Now.Hour < 12 Then
'AM
Else '12 to 23 is afternoon/evening
'PM
End If
Now it's just a matter of you figuring out exactly how you want that to work
-
Sep 7th, 2010, 08:36 PM
#9
Thread Starter
Addicted Member
Re: Greetings help...
OK SOLVED sir thanks...JuggaloBrotha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|