|
Anyone know if it's possible to store integers that are < 10 in the 01, 02, 03 format? I have database fields that store hours and minutes in numeric format and I'd like to force the minutes field to be 2 characters in my object so when I display time I don't have to do some nasty if statement and string manipulation to get 1:01 not showing up as 1:1
|
|
|
|
|
jchigg2000 wrote: Anyone know if it's possible to store integers that are < 10 in the 01, 02, 03 format?
If you do that then you are storing them as strings. Integers get stored as 32 bit values in binary.
jchigg2000 wrote: I have database fields that store hours and minutes in numeric format and I'd like to force the minutes field to be 2 characters in my object so when I display time I don't have to do some nasty if statement and string manipulation to get 1:01 not showing up as 1:1
Don't do that in the database it isn't designed for it. Databases are for storing information, not for the rendering of that information.
Also, you also don't need "nasty if statements" you just have to learn how to use string.Format()
|
|
|
|
|
Might be a coding horror...but I did this
private String TwoDigit(int x) {
return x.ToString.PadLeft(2, "0"c);
}
|
|
|
|
|
|
You don't store the rendered version of data in a database. You store the actual data. Displaying it in a ceratin format is up to your presentation code, not the database. Using numeric formats to do this is very easy:
Console.WriteLine(String.Format("{0:00}:{1:00}", hours, minutes))
|
|
|
|
|
Hello!
is it possible to have regex.replace returning 1 | 12 | 123 | 1.234 | 12.345 depending of number of digits in string?
if <nrofdigits> < 4 = no "."
if <nrofdigits> == 4 1"."234
if <nrofdigits> > 4 12"."345
If so, could anyone give me a few pointers how to achieve this?
|
|
|
|
|
livez wrote: if < 4 = no "."
if == 4 1"."234
if > 4 12"."345
Regex.Replace(str, @"(?<=\d+)(?=\d{3})", ".")
The idea is you match no character which is followed by 3 digits and is preceded by one or more digits then replace it with "."
Take a look at this expression too.
@"(?<=^\d+)(?=\d{3}$)"
Eslam Afifi
|
|
|
|
|
|
You're welcome.
Eslam Afifi
|
|
|
|
|
Hi,
Here what I mean is how to implement Heirarchical Strcutures and Tree Diagrams to show data in .Net framework.
There is an ActiveX Control VARCHART XTree from NETRONIC Software, but does anybody know how to implement Heirarchical Strcutures without using any ActiveX Control.
Dinesh
|
|
|
|
|
ddinesh,
.NET doesn't supply a control if thats what you want. You will have to write your own implementation or get a 3rd party (www.yworks.com). Theres also examples on here, have a search in the articles section.
Regards,
Gareth.
|
|
|
|
|
Hello, I have the need in my project to add a "print-a-report" utility using Crystal Reports and the end-user must be able to customize the report's design visually, much like Visual Studio allows the developer to do.
I don't have any experience with Crystal Reports and I was wondering if there was any (free) component or something to allow the end-users to change the appearance of the document or if building it oneself is the only option available, cuz I didn't find anything googling around.
Thanks in advance.
|
|
|
|
|
|
Thanks, but that's not quite what I need; this only browses through the properties of the instance itself, while I actually want the end-user to visually edit the appearance of the report using some kind of designer tool, just like Visual Studio or Access when you open a report with it.
|
|
|
|
|
If you are using SQL Server 2005 or above, you may want to take a look at Report Builder[^]. It is a component of the suite, in the form of a ClickOnce application that is intended for allowing end users to create/customize reports on SQL Server Reporting Services. A google search will net you a bunch more information.
Hope that helps to get you started.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
Why, that's interesting, didn't know about it, thanks. Alas, that's not exactly what I'm looking for.
I don't want the user to actually "generate" the report itself (the data will always be the same), but rather to be able to edit just the appearance of the document to print, so they can create and select multiple report "models" or "styles" once the report itself is already generated.
|
|
|
|
|
Can any one explain me how this licensing is done. i mean how do we generate the key and use it in the software. it would be of great help if any one can explain me this process in detail.
thank you
|
|
|
|
|
Depends entirely on you. There's plenty of obvious ways to do it, from the simple way of hard coding the license key in the program and checking if it matches, to using an algorithm to check if the key entered is valid, to using online licensing to validate a machine as being a valid license.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm currently using DateTime.TryParse() on a text field with the format DD/MM/YY. I noticed that the default behaviour of TryParse() was rather fortuitously turning 08 into 2008. Which got me thinking (apart from - next time I'll use a field with YYYY) - how does TryParse decide which century to use? I can't find anything on MSDN, and an initial Google search turned up nothing. Can anyone satisfy my curiosity and tell me the "rules" that are used? My gut feeling is that it's tucked away in the Culture settings somehow...
|
|
|
|
|
Why not download Reflector and find out for yourself? This is a fantastic tool that is invaluable if you want to find out how things work rather than just accepting that they do.
|
|
|
|
|
looking at one implementation rather than reading the documentation[^]
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: looking at one implementation rather than reading the documentation[^]
More a general hint that there are other options. Sure - read the documentation, but don't accept that it's right - actually research for yourself. After all, the MSDN is well known for its accuracy and consistency.
|
|
|
|
|
Thanks for taking the time to have a look - I didn't find/see a link to this documentation in the msdn documentation on TryParse(), but unfortunately this documentation doesn't answer my initial question. When I get a little time today, I will attempt to follow Mr O'Hanlon's suggestion. (I have avoided Reflector in the past as it seemed a bit scary)
|
|
|
|
|
Neophyte30 wrote: I didn't find/see a link to this documentation
DateTime.TryParse() has an overload that takes a IFormatProvider parameter and puts you
in charge of what is acceptable and what is not.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Everyone must have used Gtalk..
I want to know that when chat messages arrive in gtalk, one animated notification pops up near the system tray..
How to achive that?
Will C# help?
|
|
|
|