DateBox clear value key


Author
Message
Victor Sousa
Victor Sousa
StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)StrataFrame Novice (78 reputation)
Group: Forum Members
Posts: 21, Visits: 236
I noticed the the F6 key clears the DateBox control and I don't see a property to set that value. What is the best way to set the "delete" key to clear the value?
Replies
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)
Group: Forum Members
Posts: 153, Visits: 462
Using the DELETE key would be good in the next build for me also. In the meantime I will add this to the tool tip to at least let the user know.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Ross.

If you feel like it, you can use the workaround I have used.
Subclass the DateBox and add the following code to it:

    Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        Select Case keyData
            Case Keys.Delete
                '-- Delete key pressed, send an F6 to clear contents
                Return MyBase.ProcessCmdKey(msg, Keys.F6)
        End Select

        Try
            Return MyBase.ProcessCmdKey(msg, keyData)
        Catch ex As Exception
            '-- the DateBox will throw an exception if user use keys to add or subtract beyond the bounderies
            '   so in these cases we will just send Home key
            Return MyBase.ProcessCmdKey(msg, Keys.Home)
        End Try
    End Function

Hope it helps.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search