dcsimg
Results 1 to 9 of 9

Thread: Due date monthly

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2015
    Posts
    18

    Due date monthly

    Can help for this code
    Name:  Due date.png
Views: 142
Size:  4.5 KB

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,681

    Re: Due date monthly

    So what's the question? There's a screenshot... ok, great... I see a date in the Due date field... so....

    I'm not sure what you've heard about the people here, but we are not mind readers. So we don't know what you're thinking, we only know waht you've told us, which isn't much at all. There's just a pictures and some words that seem like they should be a question but also written like a statement and nothing else.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2015
    Posts
    18

    Re: Due date monthly

    Sorry about my question...i have written the code but not running.
    i mean i want to know result in due date.
    Example. I click today 01/05/2015 and i type in month " 2" and in due date have result 01/07/2015

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,681

    Re: Due date monthly

    use .Addmonths

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2015
    Posts
    18

    Re: Due date monthly

    Name:  Due date.png
Views: 34
Size:  9.6 KB
    i write the code like this

    On Error Resume Next
    TglJTDP.Value.Months = TglTransDP.Value.Months

    If Val(TerminTxt.Text) + TglTransDP.Value.Month = 2 Then
    TglJTDP.Value.Months = 2

    ElseIf Val(TerminTxt.Text) + TglTransDP.Value.Month <= 12 Then
    TglJTDP.Value.Month = TglTransDP.Value.Month + Val(TerminTxt.Text)

    ElseIf Val(TerminTxt.Text) + TglTransDP.Value.Month > 12 Then
    TglJTDP.Value.Month = (TglTransDP.Value.Month + Val(TerminTxt.Text)) Mod 12

    TglJTDP.Value.Year = (TglJTDP.Value.Year + ((TglTransDP.Value.Month + Val(TerminTxt.Text)) + (12 - TglJTDP.Value.Month)) / 12) - 1

    End If

    but not working...can help me for this

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Apr 2015
    Posts
    18

    Re: Due date monthly

    Why can't not working

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,681

    Re: Due date monthly

    I gave you a link that will add months to your date... strangely enough, the method is called AddMonths. It's all you need. ONE line of code. ONE. No fancy calculations, just one line of code.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    Junior Member valleteclark12's Avatar
    Join Date
    Mar 2015
    Location
    Best Cordless Drill & Tool Kit Buying Guide
    Posts
    16

    Re: Due date monthly

    I do not understand your question

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Apr 2015
    Posts
    18

    Re: Due date monthly

    Quote Originally Posted by techgnome View Post
    I gave you a link that will add months to your date... strangely enough, the method is called AddMonths. It's all you need. ONE line of code. ONE. No fancy calculations, just one line of code.

    -tg
    i write like this and working

    Private Sub TerminTxt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TerminTxt.TextChanged
    Dim datenow As DateTime = DateAndTime.Now
    TglTransDP.Value = datenow
    TglJTDP.Value = datenow.AddMonths(CInt(TerminTxt.Text))

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width