Results 1 to 9 of 9

Thread: (SOLVED) Greetings help...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2010
    Posts
    134

    (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.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 2010
    Posts
    134

    Re: Greetings help...

    i would like every morning please can some one teach me..

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2010
    Posts
    134

    Re: Greetings help...

    can i use timer or datepicker?

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    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.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2010
    Posts
    134

    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...

  6. #6
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    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.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jul 2010
    Posts
    134

    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.

  8. #8
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    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
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2010
    Posts
    134

    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
  •  



Click Here to Expand Forum to Full Width