|
-
Sep 13th, 2006, 11:47 PM
#1
Thread Starter
Addicted Member
-
Sep 14th, 2006, 03:37 AM
#2
Fanatic Member
Re: Code for date reverse..please Enter!
are you trying to change the date on the pocket pc, or a date variable in your appliciation
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Sep 14th, 2006, 04:50 AM
#3
Thread Starter
Addicted Member
Re: Code for date reverse..please Enter!
Yes I'm trying to change the date in my pocket pc for a specific time (that I'll set) and with another button I'll set it back to its real date .
it is a small app I want to make for using another applications in the pocket pc. means that this small app. will continue to run in my pocket pc while I operate another app.

Giving an exact answer
Saves a lot of time!!!
-
Sep 14th, 2006, 06:01 AM
#4
Fanatic Member
Re: Code for date reverse..please Enter!
This class will allow you to change the time on the device
VB Code:
Imports System.Runtime.InteropServices
Public Class DeviceDateTime
Public Sub New()
End Sub
'System time structure used to pass to P/Invoke...
<StructLayoutAttribute(LayoutKind.Sequential)> _
Private Structure SYSTEMTIME
Public year As Short
Public month As Short
Public dayOfWeek As Short
Public day As Short
Public hour As Short
Public minute As Short
Public second As Short
Public milliseconds As Short
End Structure
'P/Invoke dec for setting the system time...
<DllImport("coredll.dll")> _
Private Shared Function SetLocalTime(ByRef time As SYSTEMTIME) As Boolean
End Function
Public Function SetDeviceTime(ByVal p_NewDate As Date)
'Populate structure...
'Substitute <YOUR DATE OBJECT> with your date object returned via GPRS...
Dim st As SYSTEMTIME
st.year = p_NewDate.Year
st.month = p_NewDate.Month
st.dayOfWeek = p_NewDate.DayOfWeek
st.day = p_NewDate.Day
st.hour = p_NewDate.Hour
st.minute = p_NewDate.Minute
st.second = p_NewDate.Second
st.milliseconds = p_NewDate.Millisecond
'Set the new time...
SetLocalTime(st)
End Function
End Class
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Sep 14th, 2006, 06:25 AM
#5
Thread Starter
Addicted Member
Re: Code for date reverse..please Enter!
Thanks , But I didn't understand how to use it ?
I need to have 2 buttons in my app:
1. to change the date of my pocket pc to 01.01.1990
2. to restore the real date of today.
Can you tell me how to make this short thing.?

Giving an exact answer
Saves a lot of time!!!
-
Sep 14th, 2006, 06:30 AM
#6
Fanatic Member
Re: Code for date reverse..please Enter!
its a class...
you create an instance,
call the function,
pass in a date you want the device to be changed to
easy
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Sep 14th, 2006, 08:26 AM
#7
Thread Starter
Addicted Member
Re: Code for date reverse..please Enter!
FORGIVE ME , But I don't know how to do it.
I know that this is a class , but I don't know how to call this function
can I just put " SetDeviceTime() " in button click ?
I don't want to change the date every time.
I just want to make button1 to reverse the date of the pocket pc to 01.01.1990 ( and it suppose to be permanent for button1 , I mean I won't change it only at the code)
and button2 will return the state into the regular one ( current date).
what should I put in that 2 buttons?

Giving an exact answer
Saves a lot of time!!!
-
Sep 14th, 2006, 08:33 AM
#8
Fanatic Member
Re: Code for date reverse..please Enter!
You do realise you will have to store the current date in a variable in the application?
'member variable
m_originalDate As Date
button 1
originalDate = Date.Now()
Dim l_changeTime As New DeviceDateTime
l_changeTime.SetDeviceTime(Date.Parse("01/01/1990"))
button 2
Dim l_changeTime As New DeviceDateTime
l_changeTime.SetDeviceTime(m_originalDate)
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Sep 14th, 2006, 08:44 AM
#9
Thread Starter
Addicted Member
Re: Code for date reverse..please Enter!
Thanks,
I see that this code should be at buttons 1,2
but I didn't understand this : originalDate = Date.Now()
isn't it suppose to be : m_originalDate= Date.Now() ?
thanks for now , I'll check this code at 20:30 PM and let you know how it was.

Giving an exact answer
Saves a lot of time!!!
-
Sep 14th, 2006, 08:46 AM
#10
Fanatic Member
Re: Code for date reverse..please Enter!
oh i cant wait.....
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Sep 14th, 2006, 01:48 PM
#11
Thread Starter
Addicted Member
Re: Code for date reverse..please Enter!
It is GREAT !!! works perfect thanks.

Giving an exact answer
Saves a lot of time!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|