|
Hi bros,
Is there any way in C# (C/C++) to detect a timezone observes DST time or not.
For example: with timezone GMT+7, it does not observe DST; timezone GMT-6 observes DST time.
Anyone knows please help me.
Many thanks,
SA.
|
|
|
|
|
Try MSDN for TimeZoneInfo.IsDaylightSavingTime
If the time zone represented by the TimeZoneInfo object does not support daylight saving time, the method always returns false.
You may have to jigger with it to check a date / time combo that would be in DST if the time zone did support it.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Thanks for your answer.
I've had a look at TimeZoneInfo but is only for Microsoft Visual Studio 2008/.NET Framework 3.5 or higher. My current application is in Microsoft Visual Studio 2005/.NET Framework 2.0. It's my pain . I'm sorry not include the version of .Net framework in my question
Is there any other way?.
|
|
|
|
|
TimeZone class has the same method for .Net 2.0
|
|
|
|
|
|
I was speaking of this[^] class and method. It is there in .Net 2.0.
|
|
|
|
|
Thanks for your answer, but the method IsDaylightSavingTime is only used to indicate whether the specified date and time is within a daylight saving time period or not. It does not tell me the current timezone observes DST or not.
I want to find a way to indicate if a timezone observes DST or not. If it does then I will use the method indicating whether the specified date and time is within a daylight saving time period IsDaylightSavingTime to check for the date/time and adjust date time depend on the current time is DST or none-DST.
Hope to have your help.
|
|
|
|
|
Hi,
Does any one know how to set titles for the fixed row in the sample DataGridView obejct?
i just what the write the rows number on the fixed row that all.
thanks
Pascal
|
|
|
|
|
Ok, i allready figured it out by using the HeaderCell property
dataGridView1.Rows[0].HeaderCell.Value = "title";
Thanks any way
Pascal
|
|
|
|
|
I posted a while back about how to make ISO files or burn them to a cd-rom. I see that this is possible with IMAPI. Although I have read the articles about it here on codeproject, I still feel it is over my head. I was wondering if anyone knew of any books that went through this and taught you. It seems a lot of the books I see are the basics and thats it.
In my classes we learned nothing that would get me a job pretty much. I have learned everything I know from books. Heck out of my three C# classes I didn't even touch basic threading. Anyways, I'm interested in learning how to use CD-ROMs (burning, copying, etc), and was just wondering a good place to start.
|
|
|
|
|
how do i import user32.dll in c# in the below written code
for invoking start button
urgent please....
since this is not working
private void page_Load
{
if(condition)
{
//invoke the start key. i want the menu to pop up just as we click the start menu
SendKeys.Send("^{ESC}");
}
}
i m using this code to import user32
[DllImport("User32.Dll")]
public static extern void Send(String str);
nothing is happening
This code was posted by me...
modified on Saturday, July 11, 2009 11:43 PM
|
|
|
|
|
Not sure, but here's the pattern I use for such things:
[
System.Runtime.InteropServices.DllImportAttribute
(
"User32"
,
SetLastError=true
,
EntryPoint="FindWindow"
)
]
private static extern System.IntPtr
API_FindWindow
(
string lpClassName
,
string lpWindowName
) ;
public static System.IntPtr
FindWindow
(
string WindowName
)
{
return ( API_FindWindow
(
null
,
WindowName
) ) ;
}
|
|
|
|
|
i din get
i m not able to use this
how do i invoke start menu
is this way correct???
urgent plzzzz
[DllImport("User32.Dll")]
public static void send(string str);
private void button1_Click(object sender, EventArgs e)
{
Form1.send("^{ESC}");
}
how can i use sendkeys.send in this way
This code was posted by me...
|
|
|
|
|
Are you looking for System.Windows.Forms.SendKeys.Send ? You don't need to import to do that.
|
|
|
|
|
1. Put a breakpoint at the line: if(condition) .
2. Run your code.
3. When the breakpoint is hit, press F10. If the control goes to line:SendKeys.Send("^{ESC}");
Then the start menu will be displayed.
4. If control does not goes to that line, then condition is false and hence the start menu will not be displayed.
There is no need to import User32 for this. SendKeys is a class in System.Windows.Forms namespace.
|
|
|
|
|
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
textBox1.Focus();<br />
SendKeys.Send("E");<br />
SendKeys.Send("^(ESC)");<br />
<br />
}<br />
i put a breakpoint at SendKeys.Send("^(ESC)") but then the system hangs and i have to take taskmanager to stop the execution
but the SendKeys.Send("E") is working...(displays E on textbox)
This code was posted by me...
|
|
|
|
|
|
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags,
UIntPtr dwExtraInfo);
private void btnInvokeStartButton_Click(object sender, EventArgs e)
{
const int VK_CONTROL = 17;
const int VK_ESCAPE = 27;
const int VK_LWIN = 91;
const int VK_RWIN = 92;
const uint KEYEVENTF_KEYDOWN = 0;
const uint KEYEVENTF_KEYUP = 2;
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYDOWN, (UIntPtr)0);
keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, (UIntPtr)0);
}
modified on Monday, July 13, 2009 8:38 AM
|
|
|
|
|
I am afraid but I had to vote you since SendKeys.Send("^{ESC") works fine for me and I don't feel any need of using APIs here. Might be missing out on something.
|
|
|
|
|
I just noticed in his another thread that the method he's using is called page_Load.
I'm afraid he's trying to use SendKeys in a Web Application and for that reason he can't make it work.
|
|
|
|
|
Well, for me it's not working, and i'm the one who suggested him to use API. It does not work in C# and it does not work in VB.Net either.
SendKeys.Send("^{ESC}")
Does nothing.
Windows XP.
|
|
|
|
|
That's strange, could be an OS-related issue?
For me it's working using Win7 RC and .NET 3.5.
|
|
|
|
|
I need to increase the scope of double fee and total. The following code doesn't work because fee and total are out of the scope on the writeline.
if (time <= 3)
{
fee = 2;
total = total + fee;
}
I have more if statements involving fee and total but they all will be applied to the following writeline
Console.WriteLine("Current charge: {0:c}, Total receipts: {1:c}", fee, total);
Edit:
I made fee and total a static variable above the main method and now it works even though I set the new value of fee and total inside a block with less scope. I am not sure how this works, but it works, maybe someone can tell me why it works.
modified on Saturday, July 11, 2009 7:11 PM
|
|
|
|
|
Nathan Revka wrote: fee and total are out of the scope on the writeline.
They aren't, at least not in the code that you showed.
|
|
|
|
|
Hi,
I'm not sure what you are doing, but it could be very wrong.
public void someMethod1() {
if (time <= 3) {
int fee = 2;
}
Console.WriteLine("Fee: {0:c}", fee);
}
does not compile since fee does not exist outside the if block.
public void someMethod1() {
int fee = 0;
if (time <= 3) {
int fee = 2;
}
Console.WriteLine("Fee: {0:c}", fee);
}
does compile since fee exists outside the if block AND is guaranteed to hold a value.
int fee;
public void someMethod1() {
fee=0;
if (time <= 3) {
fee = 2;
}
Console.WriteLine("Fee: {0:c}", fee);
}
public void someMethod2() {
fee=0;
if (time <= 2223) {
fee = 2222;
}
Console.WriteLine("Fee: {0:c}", fee);
}
is probably not OK since both methods share a variable they did not intend to share. Both methods could run at the same time (using threads) and confusing each other.
If the data link between those methods is not intended, the methods really should use local variables.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|