473,395 Members | 1,969 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,395 software developers and data experts.

Question for experts

hello, i'm asking this question for the third time because i got two answers
but the were no good.
i have dataGrid and one of the cell contains date. now i want that after the
user entered 2 char (2 numbers) a "/" will appear. i tried to catch it with
currentcellchanged event and by overriding a procces but the problem is that
while i'm still at the same cell when i'm cheking the text of the cell it
contains "" only when i'm moving to the next or previous cell it shows me the
right text.

now, i'm sure there's a way to do it, but which way is it???

thanks
Nov 16 '05 #1
4 1113
Are you using a custom DataGridTableStyle? Use a custom DataGridTableStyle
where you add a GridColumnStyle for each column. For your date column, set
its GridColumnStyle to a DataGridTextBoxColumn. Then set the Format property
of DataGridTextBoxColumn for date formatting. See class DateTimeFormatInfo.

If this doesn't produce what you need, you'll have to create a class that
derives from DataGridTextBox and handle all input characters, then display
the date in the proper format.

HTH,
kevin aubuchon
"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:44**********************************@microsof t.com...
hello, i'm asking this question for the third time because i got two answers but the were no good.
i have dataGrid and one of the cell contains date. now i want that after the user entered 2 char (2 numbers) a "/" will appear. i tried to catch it with currentcellchanged event and by overriding a procces but the problem is that while i'm still at the same cell when i'm cheking the text of the cell it
contains "" only when i'm moving to the next or previous cell it shows me the right text.

now, i'm sure there's a way to do it, but which way is it???

thanks

Nov 16 '05 #2
Hi Kevin, Thanks.
yes i'm using a custom DataGridTableStyle, but i couldn't set the format as
you told me. can you give me an example?
and if i'll have to ovride do you know which procces it will be?

thanks a lot

"Kevin Aubuchon" wrote:
Are you using a custom DataGridTableStyle? Use a custom DataGridTableStyle
where you add a GridColumnStyle for each column. For your date column, set
its GridColumnStyle to a DataGridTextBoxColumn. Then set the Format property
of DataGridTextBoxColumn for date formatting. See class DateTimeFormatInfo.

If this doesn't produce what you need, you'll have to create a class that
derives from DataGridTextBox and handle all input characters, then display
the date in the proper format.

HTH,
kevin aubuchon
"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:44**********************************@microsof t.com...
hello, i'm asking this question for the third time because i got two

answers
but the were no good.
i have dataGrid and one of the cell contains date. now i want that after

the
user entered 2 char (2 numbers) a "/" will appear. i tried to catch it

with
currentcellchanged event and by overriding a procces but the problem is

that
while i'm still at the same cell when i'm cheking the text of the cell it
contains "" only when i'm moving to the next or previous cell it shows me

the
right text.

now, i'm sure there's a way to do it, but which way is it???

thanks


Nov 16 '05 #3
hi,
If you have problem with format style then you can refer this.

Now your issue is individula column formatting.

See your code.

DataGridColumnStyle TCTransNum = new DataGridTextBoxColumn() ;

TCTransNum.MappingName = "TransNum" ;

TCTransNum.HeaderText = "Trans Number" ;

TCTransNum.Width = 65 ;

here you can set one more property that will deside in which format you can
show the content of that cell.

TCTransNum.Format="c" >>> this mean you want to show the content in
currency format which is complient to your culture info.

Like this you can show the content in different format.
If you have MSDN in your machine then please try to type the link that i
mention just below. There you will get lot of format froms. And how you need
to use that.
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconcustomdatetimeformatstrings.htm
Please type this link in your VS.NET IDE help Url entry box.
Nov 16 '05 #4
i will try it,
my question now is, if by setting the format the "/" will appear automaticly?
and if not how can i do it?

thanks

"Sreejith S S Nair" wrote:
hi,
If you have problem with format style then you can refer this.

Now your issue is individula column formatting.

See your code.

DataGridColumnStyle TCTransNum = new DataGridTextBoxColumn() ;

TCTransNum.MappingName = "TransNum" ;

TCTransNum.HeaderText = "Trans Number" ;

TCTransNum.Width = 65 ;

here you can set one more property that will deside in which format you can
show the content of that cell.

TCTransNum.Format="c" >>> this mean you want to show the content in
currency format which is complient to your culture info.

Like this you can show the content in different format.
If you have MSDN in your machine then please try to type the link that i
mention just below. There you will get lot of format froms. And how you need
to use that.
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconcustomdatetimeformatstrings.htm
Please type this link in your VS.NET IDE help Url entry box.

Nov 16 '05 #5

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

Similar topics

2
by: Test User | last post by:
Hi all, (please excuse the crosspost as I'm trying to reach as many people as possible) I am somewhat familiar with Access 2000, but my latest project has me stumped. So, I defer to you...
62
by: ROSY | last post by:
hello experts plz answer following questions::: thanks in advance. 1. Out of fgets() and gets() which function is safe to use and why? 2. What is a far pointer? where we use it? 3. What does the...
26
by: ROSY | last post by:
hello 2 all, where can i get interview question on C & C++. plz give me links it will be so helpful. bye
2
by: cfriedalek | last post by:
OK, I've asked this earlier this week with no response. Since then I've also received a suggestion from the app developers but that failed with the same type error problem. Hopefully Mark Hammond...
0
by: Ken North | last post by:
If you submit the best question for the workshop at LinkedData Planet, you'll win admission to the conference, including keynotes by W3C Director Sir Tim Berners-Lee, IBM CTO for Information...
0
by: Ken North | last post by:
If you submit the best question for the workshop at LinkedData Planet, you'll win admission to the conference, including keynotes by W3C Director Sir Tim Berners-Lee, IBM CTO for Information...
0
by: knorth | last post by:
If you submit the best question for the workshop at LinkedData Planet, you'll win admission to the conference, including keynotes by W3C Director Sir Tim Berners-Lee and IBM CTO for Information...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.