Results 1 to 9 of 9

Thread: MENAGE only two click

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,652

    MENAGE only two click

    Code:
    Private Function IsLeapYear(LngY As Long) As Boolean
    
        IsLeapYear = (LngY Mod 4 = 0 And LngY Mod 100 <> 0) Or (LngY Mod 100 = 0 And LngY Mod 400 = 0)
    
    End Function
    Private Sub MSFlexGrid2_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
    
        Dim CL As Integer, RW As Integer, iMonth As Integer, P As String, A As String
    
        iMonth = cboMonth.ListIndex + 1
        Y = cboYear.Text
    
        'Me.TARRIVO.Text = ""
        'Me.TPARTE.Text = ""
    
        With MSFlexGrid2
    
            RW = .MouseRow
            CL = .MouseCol
    
            If RW >= 1 And .TextMatrix(RW, CL) > "" Then
    
                If Me.TARRIVO.Text > "" And Me.TPARTE.Text > "" Then
                    Me.TGG.Text = DateDiff("D", Me.TPARTE.Text, Me.TARRIVO.Text)
                    Me.TPARTE.Text = ""
                    Me.TARRIVO.Text = ""
                End If
                
                Else
                
                Me.LDATA1.Caption = ""
    
            End If
    
        End With
    
    End Sub
    i need to manage only two mouse click.
    for example first click insert date in ARRIVO tbox , second click insert date in PARTENZA tbox then if the two tbox are fiklled go to difference of day...

    If Me.TARRIVO.Text > "" And Me.TPARTE.Text > "" Then
    'number of days
    Me.TGG.Text = DateDiff("D", Me.TPARTE.Text, Me.TARRIVO.Text)
    Me.TPARTE.Text = ""
    Me.TARRIVO.Text = ""
    End If

    This is is a simple reserved room project
    Attached Images Attached Images  

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,450

    Re: MENAGE only two click

    As usual, I have no idea what you want! Mouse_Click on WHAT? The Grid?

    zip and attach your project as well...maybe I can figure out what you want....!
    Sam I am (as well as Confused at times).

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,652

    Re: MENAGE only two click

    Code test
    Attached Files Attached Files

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,450

    Re: MENAGE only two click

    What is the upper left control? Looks like a calendar. You call it picCal.
    Sam I am (as well as Confused at times).

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,652

    Re: MENAGE only two click

    Quote Originally Posted by SamOscarBrown View Post
    What is the upper left control? Looks like a calendar. You call it picCal.
    is a picturebox. Is my first experminent...

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,450

    Re: MENAGE only two click

    That is so convoluted. Instead of a picturebox (picCal) and the MSFlexGrid (lower left), why not use a datePicker Control?
    Sam I am (as well as Confused at times).

  7. #7
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,326

    Re: MENAGE only two click

    Quote Originally Posted by luca90 View Post
    MENAGE only two click
    Shouldn't it be three?

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,652

    Re: MENAGE only two click

    Quote Originally Posted by OptionBase1 View Post
    Shouldn't it be three?
    Yes!

  9. #9
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,450

    Re: MENAGE only two click

    This is not elegant, but does show how, with 2 clicks on a datepicker, you can populate two textboxes with dates and calculate the difference for the third textbox

    Code:
    Option Explicit
    Dim numClicks As Integer
    
    
    Private Sub DTPicker1_Change()
            numClicks = numClicks + 1
            If numClicks = 1 Then
                    Text1.Text = DTPicker1.Value
                    If Text2.Text <> "" Then
                            Text3.Text = DateDiff("d", CDate(Text1.Text), CDate(Text2.Text))
                    End If
             Else
                    Text2.Text = DTPicker1.Value
                    Text3.Text = DateDiff("d", CDate(Text1.Text), CDate(Text2.Text))
                    numClicks = 0
            End If
    End Sub
    Sam I am (as well as Confused at times).

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