|
Is this what you want ?
DateTime now = DateTime.Now;
Console.WriteLine(now.Millisecond);
Console.WriteLine(now.Ticks);
|
|
|
|
|
I haven't tried this, but I think that you can combine a standard format with a custom format in a format string: "D.fff".
---
b { font-weight: normal; }
|
|
|
|
|
hi all,
how can i process date info and insert into database (into a date/time field) without any difficulty ?
i mean there are some differences between date format in different countries. (for example: english > MM/dd/yyyy or turkish > dd/MM/yyy)
how can i first check the language info used by the computer then process date according to that with c# ?
help please ...
|
|
|
|
|
You could use a CultureInfo instance for formatting as shown below:
DateTime dt = DateTime.Parse("08/01/2006");
// Use the machines current culture.
Console.WriteLine("Current Culture: {0}.", dt.ToString(CultureInfo.CurrentCulture));
// If you want to use another culture without switching your current culture you could try.
Console.WriteLine("English (US) Formatted Date: {0}.", dt.ToString(new CultureInfo("en-US")));
Console.WriteLine("English (GB) Formatted Date: {0}.", dt.ToString(new CultureInfo("en-GB")));
// Output
English (US) Formatted Date: 8/1/2006 12:00:00 AM.
English (GB) Formatted Date: 01/08/2006 00:00:00.
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:20am.
|
|
|
|
|
This should do the trick:
Console.WriteLine("English (US) Formatted Date: {0}.", dt.ToString("d", new CultureInfo("en-US")));
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello!
I just wonder how can this small code fragment work when I have Main method as
private. How can the runtime part(CLR) access main method when it is private.
public class myApp
{
private static void Main()
{
System.Console.WriteLine("Main is now private ");
}
}
//Tony
|
|
|
|
|
You can also use Reflection to call private method in a class.
|
|
|
|
|
stancrm is totally right. With Reflection you can call private members and that is probably what the .NEt runtime does.
Visibility modifiers are mostly relevant for the compiler. With Reflection you can access everything no matter what visibility it has. This not only includes calling methods, but also accessing and changing fields which are hidden privately within external classes.
|
|
|
|
|
How do i add a link to a folder in a richtext box.
When the user click on that link the specified folder should be opened.
Thanks & Regards,
Pramod
|
|
|
|
|
You can add links using the file protocol: file://c:/windows/someFile.txt
You can also add arbitrary links to your rich text box (search CodeProject for "rich text box arbitrary link") and then use Process.Start("c:\\windows\\someFile.txt") when the arbitrary link is clicked.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Thanks for the reply,
I tried that but the Richtextbox displays the text as it is
i mean file://c:/...
whereas it should just display the file path.
And i want to set a link to a folder and not to a file.
Thanks & Regards,
Pramod
|
|
|
|
|
Yadav Pramod wrote: I tried that but the Richtextbox displays the text as it is
i mean file://c:/...
whereas it should just display the file path.
Look up the RichTextBox arbitrary links article on this site, it will allow you to do that.
Yadav Pramod wrote: And i want to set a link to a folder and not to a file
You should be able to link to a folder using the file:// protocol.
|
|
|
|
|
I have an app which defines several custom configuration classes derived from ConfigurationSection and ConfigurationSectionGroup .
In a dll I do this:
string exePath = Application.ExecutablePath;
Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
It works. Later I do:
foreach (ConfigurationSectionGroup childGroup in config.SectionGroups)
{
...
}
That works until childGroup is one of the ConfigurationSectionGroup s defined in the application. Then I get a TypeLoadException: "Could not load type '[the_section_group]' from assembly '[the_dll]'."
Is there some way I can make it load the custom types from the parent app?
Thanks in advance for any pointers.
Regards,
Phil
|
|
|
|
|
In the App.config file there is a section named configSections
The "type" member is used to specify where the type that implements the configurationSection lives e.g.
<code>
<configSections>
<section name="DataSourceProviders" type="Data_Models.Configuration.DataSourceProviderCustomConfigurationSection, Data Models, Version=1.0.2337.18582, Culture=neutral, PublicKeyToken=null" />
</configSections>
</code>
|
|
|
|
|
Doh!
I knew that, but I'd copied part of the app.config from another project and forgotten to change that bit.
Many thanks for your light in my darkness.
Regards,
Phil
|
|
|
|
|
hi
i want how to declare the images in program in order to get the images as output during run time? send me the codings too.pls help me...
regards
Murthy
|
|
|
|
|
Just embed them as a resource.
Kmurthy wrote: send me the codings too
No
Kmurthy wrote: pls help me...
I just did.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
can u tel the process? how to display the image in run time...
somewat urgent.. pls help me
asdfd fghdfg
|
|
|
|
|
How do you want to display the image?
Can you give more details of what you require?
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
i m using VC# using smartphone 2003.one image is dispalyed as a back ground image and another image(Stretchimage) is displayed as a superimposed on the background Image. the stretch image should be displayed in run time only.
direct path of the image should not be given. we declare in one variable(in that variable we have to give the path) and we call that variable whereever we want.
|
|
|
|
|
So basically:
[object].BackgroundImage = Image.FromFile(yourfilenamehere);
Is that what you want, or do you want it embedded in the executable? (It doesn't sound as if you want this done)
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
hi
i already tried that one but... it is not working. can u send ur gmail id.
just i chat n clear my all doubts.. pls
asdfd fghdfg
|
|
|
|
|
Kmurthy wrote: it is not working
What's the error message or compiler error displayed?
Kmurthy wrote: can u send ur gmail id
I can, but then if we find a solution other people can't benefit your problem (which is one of the ideas behind these forums).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
tat is ur wish. one image is dispalyed as a back ground image and another image(Stretchimage) is displayed as a superimposed on the background Image. how to display this one.
|
|
|
|