Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8882867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:40:55+00:00 2026-06-14T20:40:55+00:00

I’ve been trying to implement a custom control much like the standard Winform DateTimePicker

  • 0

I’ve been trying to implement a custom control much like the standard Winform DateTimePicker control.. only that I need my control to display architectural length values in feet and inches.. like 9′-6″.. the control should work in this way..

  • A single up-down spin button should be visible on the right side of the control..
  • The control should have 2 subfields, one for feet and one for inches.. the fields should not be individual TextBoxes with their own borders..
  • When no value has been associated with the control, it should display a ghost text string in grey color “Specify a length”..
  • When the control is clicked it should display ?’-?”, if the user clicks away without entering any length, the ghost text should be displayed again..
  • Only the subfields should be selectable when clicked.. and the updown spin button only changes the currently selected subfield..
  • The inches subfield should increment and decrement in units of 3, and wrap around its range of 0 to 11..

I think all of the functionality exist somewhere (or can be overridden) in the standard DateTimePicker control with the exception of ghost text requirement.. so probably what I should be asking is how exactly does the DateTimePicker actually work? How can I replicate its appearance and behaviour..?

I’ve looked around on Google and stackoverflow a lot but havent come across a similar question or answer..


EDIT 01:

I think a combination of updownbase and maskedtextbox might be what I need to work with.. but I have no idea how.. for one.. the maskedtextbox does not select subfields when clicked.. also how to get the updownbase to work with the currently selected subfield in the maskedtextbox..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:40:56+00:00Added an answer on June 14, 2026 at 8:40 pm

    I’ll try to post some information which hopefully will help you get started, even though it does not directly address all of your concerns. First of all, you can get a free dotpeek decompiler, do CTRL+T, find DateTimePicker type and learn how it works. Be prepared to see a lot of winapi calls. Don’t go this route unless you are confident that you will be able to comprehend everything and re-write it to work for your needs.

    A more simple way would be to create a custom control. It may not look as nice, but at least you can get it working much faster. For example, create a UserControl1, which consists of a TextBox + a Button:

    Public Class UserControl1
      Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim frm As New Form2
        Dim p = frm.PointToScreen(New Point(Me.Left, Me.Bottom))
        frm.Location = New Point(Me.ParentForm.Left, Me.ParentForm.Top + 40) + p
        frm.Show()
      End Sub
    End Class
    

    Disclaimer: Doing +40 is a poor coding standard, but that’s the best I could figure after struggling with conversion of coordinates to screen/client. If you find a better way – please suggest in comments.

    Anyway, at design time it looks like this:

    enter image description here

    Form2 is your popup, it will close if focus is lost, to imitate real popup behavior:

    Public Class Form2
      Private Sub Form2_Deactivate(sender As Object, e As System.EventArgs) Handles Me.Deactivate
        Me.Close()
      End Sub
    End Class
    

    At design time it looks like this (FormBorderStyle = None):

    enter image description here

    Compile and drop this control onto your main form. Run your application – when you click the button, ft/in dropdown will appear underneath your control. Just as any popup would do (including that of DateTimePicker), it will disappear if you click anywhere else (Deactivate event is used to make it work like this). Here is a picture, to illustrate its behavior:

    enter image description here

    Now add validation, formatting etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I need a function that will clean a strings' special characters. I do NOT
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.