Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. nullable date time picker

nullable date time picker

Scheduled Pinned Locked Moved IT & Infrastructure
databasewpfwcfhelpquestion
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrcooll
    wrote on last edited by
    #1

    hi, i have this problem , m using binding source to Bind the controls in windows form , but if i had a nullable field of type date in the database i cant bind it to the datetime picker,and i don't want to use masked textbox or textbox,here is my code Mydatetiempicker.dataBinding.add(new Binding("Value",SomeBindingSource,"DBField")) is there any way to have null value in the date time picker? or is there any control to use in this case better than datetimepicker? thx

    D M 2 Replies Last reply
    0
    • M mrcooll

      hi, i have this problem , m using binding source to Bind the controls in windows form , but if i had a nullable field of type date in the database i cant bind it to the datetime picker,and i don't want to use masked textbox or textbox,here is my code Mydatetiempicker.dataBinding.add(new Binding("Value",SomeBindingSource,"DBField")) is there any way to have null value in the date time picker? or is there any control to use in this case better than datetimepicker? thx

      D Offline
      D Offline
      dr_kreso
      wrote on last edited by
      #2

      1. Bind your datetimepicker.text, not datetimepicker.value 2. Add this code in datetimepicker_Validating(object sender, CancelEventArgs e) event: if (!datetimepicker.Checked) ((Order)orderBindingSource.Current).OrderDate= null; So, you need to manually set your Date to null value I hope it helps!

      1 Reply Last reply
      0
      • M mrcooll

        hi, i have this problem , m using binding source to Bind the controls in windows form , but if i had a nullable field of type date in the database i cant bind it to the datetime picker,and i don't want to use masked textbox or textbox,here is my code Mydatetiempicker.dataBinding.add(new Binding("Value",SomeBindingSource,"DBField")) is there any way to have null value in the date time picker? or is there any control to use in this case better than datetimepicker? thx

        M Offline
        M Offline
        mrcooll
        wrote on last edited by
        #3

        Hi, Thanks for your replay,i post this question back in October 19, 2008 m very happy that you post the an answer. :-D

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups