Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Displaying System Time and Date

Posted on 1998-12-16
4
Medium Priority
?
172 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 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