Results 1 to 18 of 18

Thread: Send Mouse Click to Row that is highlighted with Arrow Key Down/Up

Hybrid View

  1. #1
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Send Mouse Click to Row that is highlighted with Arrow Key Down/Up

    What is it that you actually want? Obviously wanting a mouse click for it's own sake is pointless. You want some result that you think a mouse click will achieve. What is that result?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2016
    Posts
    11

    Re: Send Mouse Click to Row that is highlighted with Arrow Key Down/Up

    Quote Originally Posted by jmcilhinney View Post
    What is it that you actually want? Obviously wanting a mouse click for it's own sake is pointless. You want some result that you think a mouse click will achieve. What is that result?
    Yes, there is a reason for this and I should have included it. Currently when I click on a row on the datagridview a calculation is performs that subtracts 2 dates and is displayed on lblDaysleft.Text. This is done in the Datagridview click event.

    Details:

    When the datagridview is loaded it populates the corresponding textboxes. One of those text boxes has a Warranty End Date (txtWRRTYEnd2.Text). I have the following code in the Datagridview Cell Click that calculates the remaining days of the warranty and displays it on the lblDaysleft.Text.

    This code works as should when I click on the datagridview.

    What I would like is that when a rows is highlighted when press Arrow key Down/Up to also perform the calculation.

    Any suggestions is appreciated.

    Please view attachment:

    Private Sub dgvEdit_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvEdit.CellClick

    'Assigns the variable the date from a labeltextbox that loads
    Dim todaysdate As DateTime = Me.lblTodayDate.Text

    'declares variable and assigns the text value of textbox
    Dim WrrtyEnddate As DateTime = Me.txtWRRTYEnd2.Text
    Dim Daysleft as Int32 = WrrtyEnddate.Subtract(todaysdate).Days

    Dim Results As String = Convert.ToString(Daysleft)

    'displays the days left on the warranty
    lblDaysleft.Text = Results


    End Sub[/SUP]



    Regards,
    Attached Images Attached Images  

Tags for this Thread

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