|
-
Nov 4th, 2007, 09:57 AM
#1
Thread Starter
Lively Member
Clock in VB6
i need to do a clock that is in time with the system clock but has hours minutes and seconds and are in separate textboxes. can anyone help me out with the code?
I saw that by the post by by mikeee they had this code
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = DateTime.Now.Hour.ToString
TextBox2.Text = DateTime.Now.Minute.ToString
TextBox3.Text = DateTime.Now.Second.ToString
End Sub
Here is the original post
Now that code does not work on VB6. What can I do to put it on VB6?
Also, How hard would it be to change a VB6 program to a VB2005 program? I have another program in VB6 that is basically buttons playing sounds using MMControl. How can I convert it to VB6?
-
Nov 4th, 2007, 10:13 AM
#2
Re: Clock in VB6
thats a vb6 question.
to upgrade a vb6 project to .net, open it using .net
there might be some upgrade issues you have to sort out
-
Nov 4th, 2007, 01:47 PM
#3
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 4th, 2007, 01:59 PM
#4
Re: Clock in VB6
txtHour.Text = Format(Now, "HH")
txtMin.Text = Format(Now, "MM")
txtSec.Text = Format(Now, "SS")
-
Nov 5th, 2007, 03:55 AM
#5
Re: Clock in VB6
Another option:
Code:
txtHour.Text = Hour(Now)
txtMin.Text = Minute(Now)
txtSec.Text = Second(Now)
-
Nov 5th, 2007, 06:42 AM
#6
Re: Clock in VB6
 Originally Posted by airman00
Also, How hard would it be to change a VB6 program to a VB2005 program?
You wouldn't change or convert it. You would totally rewrite it.
-
Nov 5th, 2007, 09:23 AM
#7
Re: Clock in VB6
 Originally Posted by Hack
You wouldn't change or convert it. You would totally rewrite it.
Doesn't Microsoft supply a conversion utility that will convert most of the code?
-
Nov 5th, 2007, 09:30 AM
#8
Re: Clock in VB6
 Originally Posted by MartinLiss
Doesn't Microsoft supply a conversion utility that will convert most of the code?
They certainly do, however as always the problem with using any kind of wizard is reliability. I've yet to find one that is...
So the verdict is [IMHO] - manually re-writing is much safer but of course it could be time consuming.
-
Nov 5th, 2007, 04:28 PM
#9
Re: Clock in VB6
Want to watch the clock tick? Add a timer control:
Code:
Dim MyTime As String
Private Sub Form_Load()
Timer1.Interval = 200
End Sub
Private Sub Timer1_Timer()
MyTime = Format$(Now, "hh:mm:ss")
Text1.Text = Left$(MyTime, 2)
Text2.Text = Mid$(MyTime, 4, 2)
Text3.Text = Right$(MyTime, 2)
End Sub
-
Nov 5th, 2007, 04:42 PM
#10
Re: Clock in VB6
 Originally Posted by MartinLiss
txtHour.Text = Format(Now, "HH")
txtMin.Text = Format(Now, "MM")
txtSec.Text = Format(Now, "SS")
MartinLiss, "MM" and "mm" is for Month. You have to use "nn" for Minute.
However, you can use "hh:mm" for Hour:Minute.
Last edited by anhn; Nov 5th, 2007 at 04:47 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|