1 Attachment(s)
Current Date/Time in Custom ToolStripStatusLabel
This custom status label incorporates its own Timer and displays the current date and/or time updated every second. You set the display format in the same way as for a DateTimePicker. Nothing ground-breaking but handy. Also a good way for beginners to see how to display the date and/or time in a control.
Note that the attached code was originally written in C# and was converted using Instant VB from Tangible Software Solutions. :thumb:
Re: Current Date/Time in Custom ToolStripStatusLabel
Hi, i read your topics and you seems to be really awesome.
I need your help please:
How can i display the system time on my visual basic 6 forms?
HOw can i use your code if it can work with Visual Basic?
I am not good into visual basic, i am engineer in machines where i use assembler and PLC, this is my first project i have in Visual basic 6 and i need to add the time on it so that the machine operator can be able to see the time while working
I appreciate any help you can provide,
Thanks,
Mashuli
Re: Current Date/Time in Custom ToolStripStatusLabel
Quote:
Originally Posted by Mashuli
Hi, i read your topics and you seems to be really awesome.
I need your help please:
How can i display the system time on my visual basic 6 forms?
HOw can i use your code if it can work with Visual Basic?
I am not good into visual basic, i am engineer in machines where i use assembler and PLC, this is my first project i have in Visual basic 6 and i need to add the time on it so that the machine operator can be able to see the time while working
I appreciate any help you can provide,
Thanks,
Mashuli
If you have a question regarding VB6 then you should ask it in the Classic VB forum, which for VB6 and earlier. I've never used VB6 but I can tell you that there's a Now function that will return the current date and time and a Format function that allows you to format a string. They work in very similar ways to Date.Now and String.Format in VB.NET. I have no idea how to do the equivalent of a Timer in VB6, but that's what the Classic VB forum is for: to ask those sorts of questions.
Re: Current Date/Time in Custom ToolStripStatusLabel
I'd like to use this in my app. Is this OK?
If so, how do I use it?
The .vb file has been added to my project.
I used an imports statement in the form I want to use it on. But I'm lost from there.
Re: Current Date/Time in Custom ToolStripStatusLabel
I jumped the gun. Been beating my head against this all morning. Right after I posted this I figured it out.
vb Code:
Dim dtStrip As New ToolStripDateTimeStatusLabel
dtSTrip.Available = True
dtSTrip.Owner = Me.StatusStrip
Re: Current Date/Time in Custom ToolStripStatusLabel
Quote:
Originally Posted by
jazFunk
I jumped the gun. Been beating my head against this all morning. Right after I posted this I figured it out.
vb Code:
Dim dtStrip As New ToolStripDateTimeStatusLabel
dtSTrip.Available = True
dtSTrip.Owner = Me.StatusStrip
If you've added the class to your project and built it then you should be able to add an instance to your StatusStrip in the designer, just as you would any other status strip item. It's a long time since I used this class but I'm fairly sure that was the case.
Re: Current Date/Time in Custom ToolStripStatusLabel
Quote:
Originally Posted by
jmcilhinney
If you've added the class to your project and built it then you should be able to add an instance to your StatusStrip in the designer, just as you would any other status strip item. It's a long time since I used this class but I'm fairly sure that was the case.
The reason I couldn't add it in the designer was because I didn't build it once I added the class.
After reading your post, I checked the designer and sure enough it was there.