Hello,
How do I make my program get the time from an internet server such as
time.windows.com?
Thank you!
Stilekid007
Printable View
Hello,
How do I make my program get the time from an internet server such as
time.windows.com?
Thank you!
Stilekid007
I assume the INet control... You download the webpage source and parse out the time? Just guessing though...
VB Code:
Option Explicit Dim cat() As String Private Sub Form_Load() Dim x As String, i As Integer x = Inet1.OpenURL("http://tycho.usno.navy.mil/cgi-bin/timer.pl", icString) cat() = Split(x, "<BR>") 'Chr(48)) For i = 0 To UBound(cat) If i <> 0 And InStr(cat(i), "HR") = 0 Then Text1.Text = Text1.Text & cat(i) & vbNewLine End If Next End Sub
Time.windows.com doesnt accept 3rd party requests on their website (even web browsers) so you have to use this ^^
Hello, 2eMix, I just could not get your code to work! lol I had a couple errors. I fixed a couple and then I get a variable error on the Inet1.
DEE-U - Thank you so much for the helpfull examples! I am looking at the source code right now to 3 of them that look like they will have the exact code I need!
I really appreciate your time in getting those!
I will let you know if those examples have the right code.
Thank you!
Stilekid007
Nothing much to do, my boss is still not around. :D
Haha! great!
for remix's example, you need to add the Internet Transfer Control, and a multiline textbox. You also need to add the vbcrlf's to the end of the lines.
it returns times accross the US and GMT. :thumb:
yeah i figured youd know to use the inet control, and it does work perfect ; )
Hey guys that works pretty nice! Now I see how the Inet works.
Is there anyother time update server I could use? Because I did only want one time in the text box. If not that is fine becuase I could make this work to. Just checking.
Thank you so much for the code it all works very good!
Stilekid007