[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to change or update the system date using vb?

Posted on 2012-04-11
7
Medium Priority
?
515 Views
Last Modified: 2013-12-27
The target device is a Symbol 9090 scanner running Windows CE.  My app is written in vb.net 2008.  We get the date currently in the scanner and show it in a text box using things like 'datetime.today.month' and 'datetime.today.day' etc.  Then, if it is wrong, we need to allow the user to key in the correct date, and then make it where our program can take the new date and update the scanner's system date.

How can I do this in my program--preferably in a simple way?  In searching the internet, some say you can simply set 'microsoft.visualbasic.datestring' to a string that contains the new date (which would be nice and easy), while others say the only way is to use dozens of lines of rather complex code.

I do know that I can get out of our app on the scanner, go to start> run> cmd in Windows CE, and simply type 'date 04-11-2012' to set the date--just we can do in any Windows environment.  Is there a way that is this simple from within my vb app?

I'm hoping someone can clarify for me to easiest, most direct way to do the job.  TIA
0
Comment
Question by:sasllc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 48

Accepted Solution

by:
Mikal613 earned 1000 total points
ID: 37835390
0
 
LVL 3

Author Comment

by:sasllc
ID: 37835553
But I was hoping that someone would know for sure whether or not there is an easier way that writing all that code in the link mentioned.  And, at that link, it seems to indicate that the vb code provided did not work, and he had to write his own in c#--which I don't know how to use.

I also see that this was answered way back in 2003, so it gives me hope that there may be a way now, using vb.net 2008, interfacing with a Windows CE 5.0 device.

So....is there a simple way to do this in vb? If so, how would I do it?  If not, I guess I need to get an idea of the vb code needed (not c#), no matter how complicated it is--assuming there is no easy way.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 37835559
CE 5.0 is using the old compact framework so all that "old" code is needed. That is how you do it in the CF.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Assisted Solution

by:PagodNaUtak
PagodNaUtak earned 1000 total points
ID: 37835671
Try something like this:

Haven't tested it so please let me know if it works.

Dim startInfo As New ProcessStartInfo
        Using p As New Process
            startInfo.FileName = "cmd.exe"
            startInfo.Arguments = "/C date 04-11-2011"
            startInfo.WindowStyle = ProcessWindowStyle.Hidden
            startInfo.WorkingDirectory = "c:\"
            startInfo.UseShellExecute = False
            p.StartInfo = startInfo
            p.Start()
            p.WaitForExit()
        End Using
0
 
LVL 3

Author Comment

by:sasllc
ID: 37835687
One simple line of code I'm trying right now is this:

Microsoft.VisualBasic.DateString = psNewDate

...with psNewDate being a string I build in the format mm-dd-yy.  If I run the program and key in a date of 03-03-03, then go to the command prompt on the scanner and key in 'Date', it shows  Monday, March 3, 2003.  And, the Date/Time icon in Control Panel shows the same.

Can it be that easy?  Or, am I missing something here?
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 37840876
>> Microsoft.VisualBasic.DateString = psNewDate

Correct me if I am wrong, with the above approach, you need administrator previledge to change the time?
0
 
LVL 3

Author Comment

by:sasllc
ID: 37840889
So far it hasn't been an issue.  Maybe it's because I'm doing it on a mobile device running Windows CE rather than a desktop computer or server??  

In my tests to far, it seems to work fine, although I do worry that I'm missing something--since no one on e-e or elsewhere that I've found has suggested this easy solution.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question