473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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?

Feb 8 '08 #1
3 1984
For dates isnt there a calender (graphical) to use...
Feb 8 '08 #2
gr****@gmail.com 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=DateTimePickerFormat.Custom, and
dtp.CustomFormat="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.ToString("yy.MM.dd HH:mm") to get out whatever format you
want.

--
Bjørn Brox
Feb 8 '08 #3
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)
<gr****@gmail.comwrote in message
news:3c**********************************@e10g2000 prf.googlegroups.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?
Feb 10 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
38
by: nobody | last post by:
I know that given a FormatString and a DateTime you can use DateTime.ToString(...) to convert the DateTime to a String. My question is how can you turn that around? Given a String and a...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.