[basic]UseFull Codes :)

Posts 1–15 of 15 · Page 1 of 1
[basic]UseFull Codes :)
Ok guys
first:
Code for Clock in your Forum
first open yor timer and type in this code
[php] Dim h As String = My.Computer.Clock.LocalTime.Hour
Dim m As String = My.Computer.Clock.LocalTime.Minute
Dim s As String = My.Computer.Clock.LocalTime.Second

If m < 10 Then m = "0" + m
If s < 10 Then s = "0" + s

Label1.Text = h + ":" + m + ":" + s[/php]
What it all means,Dim is the start of a new string, the "h" means hour but you could write "bananas" it dosnt matter,apart from being realivant to your forum. you can see after "Dim h as string" show you that your creating a new String then what we added after it was "my.computer.clock.localtime.* *"
shows you were they find the infomation they were looking for,like to find out how to show if your online,which is in the next part.-




The next Basic code will show you how to show if you are online or not
[php]Dim online as string = My.Computer.network.Isavailable
label2.text = online
if label2.text = ("True") then
label2.text = ("Online")
else
label2.text = ("Offline")
End if[/php]
this,like the first creates a string called "Online"
it takes infomation from your computer and it users it in your App
thanks guys
i hope i helped
any questions post them here

i hope its helpfull
ive been reading books on VB
they really help
For your first snippet

[php]
Label1.text = timeofday
[/php]

for your second one.

[php]
If My.Computer.IsAvailable Then
Label2.Text = "Online"
Else
Label2.Text = "Offline"
Endif
[/php]



Also, this is snippets not in need of a whole topic.
Code:
Dim online as string = My.Computer.network.Isavailable
label2.text = online
if label2.text = ("True") then
label2.text = ("Online")
else
label2.text = ("Offline")
End if
[php]If my.computer.network.isavailable then
label2.text = "Online"
else
Label2.text = "Offline"
end if[/php]

My.Computer.Network.IsAvailable returns a boolean, why would you declare a string to check it?

Code:
 Dim h As String = My.Computer.Clock.LocalTime.Hour
        Dim m As String = My.Computer.Clock.LocalTime.Minute
        Dim s As String = My.Computer.Clock.LocalTime.Second

        If m < 10 Then m = "0" + m
        If s < 10 Then s = "0" + s

        Label1.Text = h + ":" + m + ":" + s
[php]label1.text = Now.Hour & ":" & Now.Minute & ":" & Now.Second[/php]

Meh.

Fuck you Jason.

+ TimeofDay was screwed up for me.
Quote Originally Posted by Imported View Post
For your first snippet

[php]
Label1.text = timeofday
[/php]

for your second one.

[php]
If My.Computer.IsAvailable Then
Label2.Text = "Online"
Else
Label2.Text = "Offline"
Endif

[/php]



Also, this is snippets not in need of a whole topic.
what is Bold and Red is because its wrong
it dosnt tell you if your internet is acceable
so it is pointless :O


i like my code better you trolls
Lol maybe you should actually read descriptions of classes before you try and assume you know better than us. My.Computer.Network is a boolean so converting it first to string and then comparing is just a pointless waste of code when you can directly check whether it's true or false and act accordingly, it does work so whatever.
Quote Originally Posted by Imported View Post
Lol maybe you should actually read descriptions of classes before you try and assume you know better than us. My.Computer.Network is a boolean so converting it first to string and then comparing is just a pointless waste of code when you can directly check whether it's true or false and act accordingly, it does work so whatever.
i didnt say i was smart or better or anything
i just reackon my code is easy for beginners(like me) understand
when i finish my book im sure ill be as good as u in VB
well maybe after reading it twice
Quote Originally Posted by Devient_ View Post


i didnt say i was smart or better or anything
i just reackon my code is easy for beginners(like me) understand
when i finish my book im sure ill be as good as u in VB
well maybe after reading it twice
You said my code was wrong when it clearly isn't and also yours encourages beginners to adopt poor coding methods. Like wtf is this

[php]
Dim online as string = My.Computer.network.Isavailable
label2.text = online
if label2.text = ("True") then
label2.text = ("Online")
else
label2.text = ("Offline")
End if
[/php]

Let me get this straight, you first convert a boolean to string for "online" then make a label.text = online THEN check what the label.text is and then change the Label.Text again? Why would you do that, even allowing for you to declare it as string, you should have done this:

[php]
Dim online as string = My.Computer.network.Isavailable

if Online = ("True") then
Label2.Text = ("Online")
else
label2.text = ("Offline")
End if
[/php]

Rather than doing a massive roundabout method.
Quote Originally Posted by Imported View Post


You said my code was wrong when it clearly isn't and also yours encourages beginners to adopt poor coding methods. Like wtf is this

[php]
Dim online as string = My.Computer.network.Isavailable
label2.text = online
if label2.text = ("True") then
label2.text = ("Online")
else
label2.text = ("Offline")
End if
[/php]

Let me get this straight, you first convert a boolean to string for "online" then make a label.text = online THEN check what the label.text is and then change the Label.Text again? Why would you do that, even allowing for you to declare it as string, you should have done this:

[php]
Dim online as string = My.Computer.network.Isavailable

if Online = ("True") then
Label2.Text = ("Online")
else
label2.text = ("Offline")
End if
[/php]

Rather than doing a massive roundabout method.
Ok,point takin
thanks for the help J-d
Trolling <> improving code
Thats ok
Post snippets in snippets vault. Simple as that.
Quote Originally Posted by NextGen1 View Post
Post snippets in snippets vault. Simple as that.
haha nice
Posts 1–15 of 15 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?