﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » DateBox clear value key</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 05:45:19 GMT</lastBuildDate><ttl>20</ttl><item><title>DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26344.aspx</link><description>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?</description><pubDate>Thu, 16 Feb 2012 13:43:57 GMT</pubDate><dc:creator>Victor Sousa</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost30930.aspx</link><description>Hi Ross.&lt;br/&gt;&lt;br/&gt;If you feel like it, you can use the workaround I have used.&lt;br/&gt;Subclass the DateBox and add the following code to it:&lt;br/&gt;&lt;br/&gt;&lt;span&gt;[codesnippet]&amp;nbsp;&amp;nbsp;&amp;nbsp; Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case keyData&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case Keys.Delete&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Delete key pressed, send an F6 to clear contents&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return MyBase.ProcessCmdKey(msg, Keys.F6)&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select&lt;br/&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return MyBase.ProcessCmdKey(msg, keyData)&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- the DateBox will throw an exception if user use keys to add or subtract beyond the bounderies&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp; so in these cases we will just send Home key&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return MyBase.ProcessCmdKey(msg, Keys.Home)&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;br/&gt;[/codesnippet]&lt;br/&gt;Hope it helps.&lt;br/&gt;&lt;/span&gt;</description><pubDate>Thu, 16 Feb 2012 13:43:57 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost30929.aspx</link><description>&lt;span style="text-decoration: underline;"&gt;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.&lt;/span&gt;</description><pubDate>Thu, 16 Feb 2012 12:22:15 GMT</pubDate><dc:creator>Ross L. Rooker, Sr.</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26364.aspx</link><description>[quote]Just need a configurable clear key to make it perfect [/quote]&lt;br&gt;
&lt;br&gt;
I will try and get this in the next update. ;)&lt;br&gt;
&lt;br&gt;
[quote]Will the week start date make in the next build ?[/quote]&lt;br&gt;
&lt;br&gt;
I will look at this as well and see if we can squeeze this into the next update. :)</description><pubDate>Tue, 09 Mar 2010 08:15:04 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26363.aspx</link><description>Trent,&lt;/P&gt;&lt;P&gt;Will the week start date make in the next build ? :Whistling:&lt;/P&gt;&lt;P&gt;I would like to use the DateBox, but as earlier mentioned the week in Denmark starts on monday.</description><pubDate>Tue, 09 Mar 2010 03:40:09 GMT</pubDate><dc:creator>Teddy Jensen</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26359.aspx</link><description>Trent, i agree. The DateBox is much better for data entry. i'm just starting w/.Net and Strataframe and started using the datepicker before discovering the DateBox. Datepicker was very quirky and aside from the calender drop down, seemed a step backward coming from VFP date entry. Just need a configurable clear key to make it perfect :)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;</description><pubDate>Mon, 08 Mar 2010 22:06:13 GMT</pubDate><dc:creator>Victor Sousa</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26356.aspx</link><description>Wow...that is the first time I have heard that.&amp;nbsp; The number one thing is ease of date entry.&amp;nbsp; When we tried to use the standard .NET wrapped DateTimepicker in our medical application, we had hate mail coming our way...a lot of it!&amp;nbsp; In fact, we had several other internal applications that used that control...and we got hate mail from them too.&amp;nbsp; In fact, I sent my self some hate mail when I had to use it in the real-world. :w00t:&lt;/P&gt;&lt;P&gt;Once we released the DateBox control in our medical application our users sent us some love notes :P&amp;nbsp; The ease of date entry was the main purpose behind it.&amp;nbsp; Not to mention total control.&amp;nbsp; We can enhance this control and do whatever we want with it.&amp;nbsp; It truth, the standard DateTimepicker is&amp;nbsp;okay if you are just going to have some simple dates popped up there that are not a major piece of your app.&amp;nbsp; But when it comes to heads down entry and large date entry, it makes a huge difference.&lt;/P&gt;&lt;P&gt;Not that it matters at this point, but we also got some not quite hate mail but definitely not love notes from a number of SF users as well that were passing along complaints from their users.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I will create a demo at some point, but there is a lot of intelligence in the DateBox that isn't in the DateTimePicker.&amp;nbsp; For example, in the DateBox, I can enter the control and type "5560" and it will input "05/05/1960" into the control.&amp;nbsp; It has the inteligence to figure this type of thing out.&amp;nbsp; You could also type "010180" and it would put "01/01/1980."&amp;nbsp; Let me put it like this, I was grilled by QA until we made the QA team smile...and it ain't easy to do that! :D&lt;/P&gt;&lt;P&gt;As for the clear command, I will most likely expose this property in the next update and you can do as you like.&amp;nbsp; This makes sense anyway. ;)</description><pubDate>Mon, 08 Mar 2010 20:56:48 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26352.aspx</link><description>I get that the datebox control is written from the ground up etc and is not just a subclass of the .net datepicker.  But I still don't get why.  Is it a theme thing?  &lt;br&gt;
&lt;br&gt;
You know I am a drinker of the Microfour Koolaid but I'm finding the SF wrapped datepicker control does everyting the datebox does and maybe a little more.  Realized after adding plus and minus quicken-like keypresses that arrow keys in month day or year worked too.&lt;br&gt;
&lt;br&gt;
FWIW this is what I did to mod it in my own UI library :&lt;br&gt;
&lt;br&gt;
[codesnippet]Imports System.Windows.Forms&lt;br&gt;
&lt;br&gt;
Public Class Datepicker&lt;br&gt;
    Inherits MicroFour.StrataFrame.UI.Windows.Forms.DateTimePicker&lt;br&gt;
&lt;br&gt;
    Private Sub dbkeypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress&lt;br&gt;
        If e.KeyChar() = "+" Or e.KeyChar() = "=" Then&lt;br&gt;
            Me.Value = Me.Value.AddDays(1)&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "_" Or e.KeyChar() = "-" Then&lt;br&gt;
            Me.Value = Me.Value.AddDays(-1)&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "t" Or e.KeyChar() = "T" Then&lt;br&gt;
            Me.Value = System.DateTime.Now()&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "M" Or e.KeyChar() = "m" Then&lt;br&gt;
            Dim dt As DateTime = New DateTime(Me.Value.Year, Me.Value.Month, 1)&lt;br&gt;
            Me.Value = dt&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "H" Or e.KeyChar() = "h" Then&lt;br&gt;
            Dim dt As DateTime = New DateTime(Me.Value.Year, Me.Value.Month + 1, 1)&lt;br&gt;
            Me.Value = dt.AddDays(-1)&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "Y" Or e.KeyChar() = "y" Then&lt;br&gt;
            Dim dt As DateTime = New DateTime(Me.Value.Year, 1, 1)&lt;br&gt;
            Me.Value = dt&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "R" Or e.KeyChar() = "r" Then&lt;br&gt;
            Dim dt As DateTime = New DateTime(Me.Value.Year + 1, 1, 1)&lt;br&gt;
            Me.Value = dt.AddDays(-1)&lt;br&gt;
        End If&lt;br&gt;
        If e.KeyChar() = "C" Or e.KeyChar() = "c" Then&lt;br&gt;
            SendKeys.Send("%{DOWN}")&lt;br&gt;
&lt;br&gt;
        End If&lt;br&gt;
&lt;br&gt;
    End Sub&lt;br&gt;
End Class&lt;br&gt;
[/codesnippet]&lt;br&gt;
&lt;br&gt;
BTW, is there a sample of the new calendar thingy around anywhere?  Maybe that is what I'm not getting about datebox.&lt;br&gt;
&lt;br&gt;
:hehe:</description><pubDate>Mon, 08 Mar 2010 19:18:10 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26351.aspx</link><description>&lt;br&gt;
The Delete key doesn't seem to do anything in the DateBox control. It doesn't even clear the highlighted text.</description><pubDate>Mon, 08 Mar 2010 18:40:19 GMT</pubDate><dc:creator>Victor Sousa</dc:creator></item><item><title>RE: DateBox clear value key</title><link>http://forum.strataframe.net/FindPost26348.aspx</link><description>Well, this property should be slightly exposed, but delete would technically interfere with other logic in the control.  The delete currently deletes any selected text in the control.  Let me tinker with this a little to see if it is safe for us to expose this property.  The other option is to subclass the DateBox and override the ProcessCmdKey which gives you the base entry point...but this is one of those "Do at your own risk" things. :)</description><pubDate>Mon, 08 Mar 2010 16:26:35 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>