MonthCalendar problem
-
Hi, I have a readonly textBox on my windows form, when the user clicks on the textBox I display a monthCalendar control, then in the DateSelected event I populate the textBox with the selected date. My only problem is that the user might decide that the date is not necessary and want to remove it from the textBox. I have tried looking at the hitTest method of the calendarControl but the hitTestArea is always returned as nowhere. Does anyone have any idea of how I might be able to remove the date from the textBox?? Thanks in advance. Gavin Jeffrey
-
Hi, I have a readonly textBox on my windows form, when the user clicks on the textBox I display a monthCalendar control, then in the DateSelected event I populate the textBox with the selected date. My only problem is that the user might decide that the date is not necessary and want to remove it from the textBox. I have tried looking at the hitTest method of the calendarControl but the hitTestArea is always returned as nowhere. Does anyone have any idea of how I might be able to remove the date from the textBox?? Thanks in advance. Gavin Jeffrey
This is really just a UI design issue, you could simply add a small button with a
Text
property of "Clear" which would then clear the value from theTextBox
. - Nick Parker
My Blog | My Articles -
Hi, I have a readonly textBox on my windows form, when the user clicks on the textBox I display a monthCalendar control, then in the DateSelected event I populate the textBox with the selected date. My only problem is that the user might decide that the date is not necessary and want to remove it from the textBox. I have tried looking at the hitTest method of the calendarControl but the hitTestArea is always returned as nowhere. Does anyone have any idea of how I might be able to remove the date from the textBox?? Thanks in advance. Gavin Jeffrey
How about a
Button
"Clear Date" or something similar besides yourTextBox
whose Click event handler simply clears theText
property of yourTextBox
.?
-
How about a
Button
"Clear Date" or something similar besides yourTextBox
whose Click event handler simply clears theText
property of yourTextBox
.?
We apparently posted at the same time, however I must have beaten you by mere seconds. ;) - Nick Parker
My Blog | My Articles -
We apparently posted at the same time, however I must have beaten you by mere seconds. ;) - Nick Parker
My Blog | My Articles -
Thanks guys, Well this seems to be my only option - I was hoping to find a "cleaner" solution since my form is already so cluttered. I have searched endlessly but i can't seem to find any other way besides a button. Looks like i will have to go with the button. Thank for the help. Gavin
-
Thanks guys, Well this seems to be my only option - I was hoping to find a "cleaner" solution since my form is already so cluttered. I have searched endlessly but i can't seem to find any other way besides a button. Looks like i will have to go with the button. Thank for the help. Gavin
Another option that comes to mind is using a ContextMenu. For example this could be displayed after right-clicking your TextBox and contain the MenuItem "Clear Date". After clicking the MenuItem the TextBox is cleared. Never you really worked with ContextMenus so I can give no further help. But I think it's worth a try and shouldn't be that complicated:)