SldCvr
SldCvr

Reputation: 5

Label text remains unchanged

So I'm deliberately trying to make a Download ETA Calculator using Visual Basic 2013 Ultimate.. but after 3 hours of work, I tried running it but it won't show the final result (The Estimated Time). I am also asking you how to convert the result into Time format.. here is the code

Public Class Form1

Private Property z As Object

Private Sub Label1_Click(sender As Object, e As EventArgs)

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs)

End Sub

Private Sub LinkLabel1_LinkClicked(sender As Object, e As 
            LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
    Process.Start("www.speedtest.net")
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) 
                          Handles Button1.Click
    Dim x, y, z, a As Integer
    Dim sum

    x = TextBox1.Text
    y = TextBox2.Text
    sum = Label1

    If RadioButton1.Checked = True And RadioButton3.Checked = True Then
        z = x / 1024 / y
        a = z / 60
        sum = a / 60
    End If

    If RadioButton1.Checked = True And RadioButton4.Checked = True Then
        z = x / 1024 / y
        a = z / 60 * 1024
        sum = a / 60
    End If
    If RadioButton2.Checked = True And RadioButton3.Checked = True Then
        z = x / 1048576 / y
        a = z / 60
        sum = a / 60
    End If
    If RadioButton2.Checked = True And RadioButton4.Checked = True Then
        z = x / 1048576 / y
        a = z / 60 * 1024
        sum = a / 60
    End If
End Sub

Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) 
                                        Handles                                                  
                                        RadioButton1.CheckedChanged

End Sub
End Class

Error 2 http://tny.cz/7b5711f7

Error 3 http://tny.cz/09bf1f96

Upvotes: 0

Views: 152

Answers (1)

5uperdan
5uperdan

Reputation: 1501

Dim sum
sum = Label1

Presumably Label1 is a label control so you're setting a variable to be equal to the label control.

Later on, you're trying to set this variable of type label control to a decimal

sum = a / 60

I would say you want probably want to replace all your

sum = a / 60

with something like

label1.Text = New TimeSpan(a / 60, 0, 0).ToString()

and forget about variable sum all together

Upvotes: 1

Related Questions