473,761 Members | 8,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1999
For dates isnt there a calender (graphical) to use...
Feb 8 '08 #2
gr****@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
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.c omwrote in message
news:3c******** *************** ***********@e10 g2000prf.google groups.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
3975
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 will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
38
807
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 FormatString, how can you convert the String back to a DateTime? DateTime.Parse(...) doesn't use the FormatString. Now admitedly, if the format string is just "MM", it can't be done. But if the format string is "yyyyMMdd", or "ddMMMyyyy hhmmsst", it...
26
2686
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' How do i do that? Reny ---
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.