Solved

Displaying System Time and Date

Posted on 1998-12-16
4
164 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 50 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

691 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