?
Solved

Displaying System Time and Date

Posted on 1998-12-16
4
Medium Priority
?
169 Views
Last Modified: 2010-05-03
I need to create a bar that will appear on the bottom of the screen that will display a user defined ID number, time of the system clock, time since a physiology program begins recording (the manufacturer will help me with this), and the date. I know QBasic but am new to Visual Basic 6.0.
I have created the input form and a form to display a bar. I am not sure how to display the clocks and date on the bar. Any advice would be appreciated.
0
Comment
Question by:zrick
[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
4 Comments
 

Accepted Solution

by:
JimmieToo earned 200 total points
ID: 1450827
Zrick:

I'm assuming you have a 'statusbar' on your form but this approach will work with anything that has the text property.  If it was a Label then of course you would use the caption property.

Set the timer (called "tmrShowTime") interval to say 250 to 500.
You could combine the date and time and show the whole works in the statusbar.  Here, I'm displaying the date as a tooltip, just as Win 95 does on the desktop.

Private Sub tmrShowTime_Timer()

    'update the time in the statusbar
    With StatusBar1.Panels(2)
        .Text = Format$(Time$, "h:mm:ss am/pm")
        .ToolTipText = Format$(Now, "Long Date")
    End With

End Sub

Now for the other information, add the required Panels to your status bar.  Then to display user ID number, for instance;

Assume Text1 is entry for ID.

In the change event:

Private Sub Text1_Change()

    StatusBar1.Panels(1).Text = "User ID: " & Text1.Text

End Sub

Finally, you have another timer which is enabled by an event trigger supplied by the manufacturer.  You save the starttime in a variable and compare it at a regular interval with the current time and calculate the elapsed time.  Display the result in a textbox, label, another statusbar panel or whatever.

Hope this does the trick.

Jim


0
 

Author Comment

by:zrick
ID: 1450828
JimmieToo, Thanks for your answer, I look forward to trying this out! Rick
0
 

Author Comment

by:zrick
ID: 1450829
JimmieToo,

I am having difficulty applying the above. I ran the vbasic wizard to create an application and this created a statusbar with three panels: "status", date, and time. If I right click on the statusbar I get a properties menu. I can't change the value in ToolTip or Text to show "User ID: "& Text1.Text as it shows just that, these words witht the quotes and everything. If I try to add the statements you wrote out to the code itself, the program does not recognize them. Newbie as I am, I know I am doing something wrong here. I'd appreciate a bit more help.
0
 

Author Comment

by:zrick
ID: 1450830
I got it now by using Labels instead of the StatusBar.
Rick
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

770 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