Custome control from DateTime format string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gregcm@gmail.com

    Custome control from DateTime format string

    I've got a custom control that is trying to allow the user to enter a
    DateTime in a definable format and I was wondering if there was an
    easy way to alter the look of said control based on the contents of
    the format string. For example I would like a year TextBox that is
    small if input formatting string contains "yy" and larger if it
    contains "yyyy".
    I guess I could write a parser with string.Contains et. al. but that
    seems fairly kludgy, any ideas?

  • christery@gmail.com

    #2
    Re: Custome control from DateTime format string

    For dates isnt there a calender (graphical) to use...

    Comment

    • =?ISO-8859-1?Q?Bj=F8rn_Brox?=

      #3
      Re: Custome control from DateTime format string

      gregcm@gmail.co m skrev:
      I've got a custom control that is trying to allow the user to enter a
      DateTime in a definable format and I was wondering if there was an
      easy way to alter the look of said control based on the contents of
      the format string. For example I would like a year TextBox that is
      small if input formatting string contains "yy" and larger if it
      contains "yyyy".
      I guess I could write a parser with string.Contains et. al. but that
      seems fairly kludgy, any ideas?
      >
      Use DateTimePicker dtp; with dtp.Format=Date TimePickerForma t.Custom, and
      dtp.CustomForma t="yy.MM.dd HH:mm" for example.

      Believe me, you will never be able to trap all variants a user might try
      to use in a TextBox.

      Use dtp.Value.ToStr ing("yy.MM.dd HH:mm") to get out whatever format you
      want.

      --
      Bjørn Brox

      Comment

      • Ignacio Machin \( .NET/ C# MVP \)

        #4
        Re: Custome control from DateTime format string

        Hi,

        You need to give more details, is this a web or a win app?
        Where you got your control from?
        Do you have the source code (you are talking about modifying it after all)


        <gregcm@gmail.c omwrote in message
        news:3c3453be-22b1-4100-8fdc-75db06365ae1@e1 0g2000prf.googl egroups.com...
        I've got a custom control that is trying to allow the user to enter a
        DateTime in a definable format and I was wondering if there was an
        easy way to alter the look of said control based on the contents of
        the format string. For example I would like a year TextBox that is
        small if input formatting string contains "yy" and larger if it
        contains "yyyy".
        I guess I could write a parser with string.Contains et. al. but that
        seems fairly kludgy, any ideas?
        >

        Comment

        Working...