|
No, the problem occurs because Win32 and .NET make different choices with regard to dealing with Daylight Saving Time.
For a discussion, see here:
http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx
To compensate, you have to adjust the time you use with SetLastWriteTime and GetLastWriteTime. When setting, adjust from .Net to Win32. When getting, adjust from Win32 to .NET. Here's some example code:
static DateTime AdjustTime_DotNetToWin32(DateTime time)
{
DateTime adjusted = time;
if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime())
adjusted = time - new System.TimeSpan(1, 0, 0);
else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime())
adjusted = time + new System.TimeSpan(1, 0, 0);
return adjusted;
}
static DateTime AdjustTime_Win32ToDotNet(DateTime time)
{
DateTime adjusted = time;
if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime())
adjusted = time + new System.TimeSpan(1, 0, 0);
else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime())
adjusted = time - new System.TimeSpan(1, 0, 0);
return adjusted;
}
void MySetLastWriteTime(String targetFile, DateTime t)
{
DateTime adjusted = AdjustTime_DotNetToWin32(t);
System.IO.File.SetLastWriteTime(targetFile, adjusted);
}
DateTime MyGetLastWriteTime(String targetFile)
{
DateTime t = System.IO.File.GetLastWriteTime(targetFile);
return AdjustTime_Win32ToDotNet(t);
}
|
|
|
|
|
Hi
I'm designing an interface with navigation bar ,, it's viewing my own control on the same form ,,, but i want to chech if the control is aleady viewed to prevent the user from open it more than one time ..
jooooo
|
|
|
|
|
Create a static variable, so it's visible across all instances of the control, and set it to true when the first one is shown. If it's true, don't allow more to be created.
Christian Graus - C++ MVP
|
|
|
|
|
|
*grin* not sure if I earned all of that, but sure glad to help.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have a CheckedListBox (CLB) on my form, the user can add, edit and remove items. I also have a context menu for the CLB that has the option to remove all checked items. What i need to know is how to structure a for next statement to cycle through and remove all checked items.
Posted by The ANZAC
|
|
|
|
|
For i As Integer = 0 To CLB.Items.Count - 1<br />
CLB.SetItemChecked(i, False)<br />
Next
|
|
|
|
|
Hey ANZAC,
I'm not sure if you mean remove the item or uncheck it, but if you want to remove an item try:
For i As Integer = YourCHB.CheckedIndices.Count - 1 To 0 Step -1
YourCHB.Items.RemoveAt(YourCHB.CheckedIndices.Item(i))
Next
The reason why I am using CheckedIndices is because when I give i to Item, it knows I want the checked item index rather than the general index.
I did think of using the GetEnumerator method on CheckedIndices and going through the collection that way, but because I modify the collection, it would stuff that up, which is why I'm going backwards because the positions are getting changed on each remove.
|
|
|
|
|
Thanks, i should have stated, i am trying to remove all of the checked items, this will probably work, but i figured it out anyways.
Dim C As Integer = clbList.Items.Count
If Me.clbList.CheckedIndices.Count > 0 Then
Do Until C = 0
If clbList.CheckedIndices.Contains(C) Then
clbList.Items.RemoveAt(C)
Me.clbList.SelectedIndex = 0
End If
C -= 1
Loop
If clbList.CheckedIndices.Contains(Me.clbList.SelectedIndex) Then
Me.clbList.Items.RemoveAt(Me.clbList.SelectedIndex)
End If
End If
This is my method, not as clean but i like it well enough.
Posted by The ANZAC
|
|
|
|
|
Hi!
Is there a way to draw line and bar chart on the same chart using AxMSCHART?
or
Is there a way to do paint both Bar and line graph on a PictureBox?
Or
Draw BarGraph on one Picturebox and Line on another picturebox,make one of them transparent so it would expose the other graph that is located right beneath.
|
|
|
|
|
If you want to do graphics programming, you need to forget about using picture boxes, so you can just draw it yourself.
Christian Graus - C++ MVP
|
|
|
|
|
Hi everyone!
I trying to write a app to do some chinese->english translation using google. I have all the code down to generate the right URL, i.e.
http://translate.google.com/translate_t?text=%E4%BD%A0%E5%A5%BD&hl=en&langpair=zh-CN|en&tbb=1&ie=utf-8
I can paste that into a browser and it works, but when I try to request the page using msxml 6.0 I get a 403 error (forbidden). I tried requesting "www.google.com" first, thinking maybe I need a cookie, and google.com returns fine, but still when I go on to the translate url I get the 403. Is there anyway around this, maybe changing my request header?
I also tried another approach with the WebBrowser control. I had a little more success using it; the page gets returned with no 403, but, well hard to explain unless you look at this page:
http://translate.google.com/transla...&tbb=1&ie=utf-8
so if you put that in your browser, you see ?? (or chinese characters if you have the language pack installed) in the 'Original Text:' box, and "Hello" as the translation. However, when I use this same URL in the webbrowser control of vb.net the returned page has ?? as the 'Original Text:' and "-" as the translated text.
Now this is really making me go bonkers. Anyone tell me what the heck is going on? I will bow down if you help me through this
-Josh K.
Co-Founder/VP
www.GamerWealth.com
|
|
|
|
|
hi there,
How can we use resource file to implement multi language in our program?
please help
Syed Shahid Hussain
|
|
|
|
|
|
Really Thanks Friend.
Syed Shahid Hussain
|
|
|
|
|
Hi I am trying to open a web page in a new browser window, I can easily open a page in the last used window:
System.Diagnostics.Process.Start("http://www.google.com")
But I would like to have it opened in a new window.
Any suggestions?
Kevin
|
|
|
|
|
If the page opens in the last window, in a new window or in a new tab depends on the settings in the browser.
---
b { font-weight: normal; }
|
|
|
|
|
There has got to be a way I can force it to open in a new window.
|
|
|
|
|
Try launching a new copy of IE with the command line parameter of the site you want to open.
iexplore.exe http:
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Under Tools/Internet Options/Advanced Tab. I think it's something like "Reuse windows to launch shortcuts" or something like that.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi
i use crystal Report Xi and visual studion 2005
i put image in crystal report and link this image with parameter
its working fine with design and preview time if we provide other image name at preview time in parameter
if i call this report with vs2005 vb.net program and pass the image name by parameter but it not show the new image it is show only old image
i already checkwith the same process with put images name in database and link this database field name with image, but its show old image
if any one work on the same problem pls help me
Sanjay Modi
modi_sanjay@yahoo.com
Sanjay Modi
|
|
|
|
|
hi dear programmers
what is code for adding this menu see this link please:
http://www.zizi.ir/reg/image.php?id=9947all copy.JPG
|
|
|
|
|
This involves writing a Photoshop plugin. Your best bet for information concerning this would be Adobe's Photoshop Developer Center[^]. You'll ned to download the SDK for the version of PS you want to develop against.
I have no samples or no idea where to start because I've never had any cause to do Photoshop development.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi
i have downloaded sdk but i need a code for this project.
any body can help me?
|
|
|
|
|
Since what you're asking is so specific to Photoshop, how about going back to Adobe's developer center and then finding the link to their community boards and asking there? Like I said, that is going to be the best source of information for what you're doing. There are VERY few people who do any kind of Photoshop development around here. The chances of any of them seeing your question are very remote. Your best chance of getting any information is going to be in a place that specializes in Photoshop development. CodeProject isn't that place. If you've got specific questions about Visual Basic.NET, then this is the place to come.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|