Solved

Date Binding Problem

Posted on 2006-06-30
1
270 Views
Last Modified: 2008-02-01
Hi,

Here's the question:  

I have a textbox and two numericUpDown's on my form.  The are all bound to one date field in my database, each with different formatting.  ie.  The textbox shows the date as "dd/MM/yyyy", numericUpDown1 as "HH" and NumericUpDown2 as "mm".

So I have the date displayed, the hour and the minutes displayed.  This works fine and the correct values do get displayed.  However, when I change the hour value or minute value in the numericUpDown controls and then click on another control the NumericUpDown's 'flick' back to there original values.

I think this is because I have to use the binding's parse event to parse the numericUpDown's value into the correct date format.  If i'm correct in this assumption how would I go about doing this?

I have already added code to the bindings Format events, just a bit unsure what I need to do on the Parse events.
0
Comment
Question by:AMLabels
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
ElrondCT earned 250 total points
ID: 17021057
I'm not sure how to answer the exact question you're asking, but I can suggest an alternative way to get more or less the same results. You're binding three controls to the same database field, which raises potential problems of the different controls fighting with each other. I don't know how .NET is designed to handle such conflicts. It might be less confusing to use a single control for all of it.

If you use a DateTimePicker with the ShowUpDown property set to True, Format to Custom, and CustomFormat to "dd/MM/yyyy HH:mm", you'll get the numeric up/down built into the control for all the items within the control, and no need to do your own parsing.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question