所以我故意尝试使用Visual Basic 2013 Ultimate制作下载ETA计算器..但是经过3个小时的工作后,我尝试运行它,但它不会显示最终结果(估计时间) )。我也问你如何将结果转换为时间格式.. 这是代码
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
答案 0 :(得分:1)
Dim sum
sum = Label1
据推测,Label1是一个标签控件,因此您要将变量设置为等于标签控件。
稍后,您尝试将此标签控件类型的变量设置为小数
sum = a / 60
我想说你想要替换你所有的
sum = a / 60
类似
label1.Text = New TimeSpan(a / 60, 0, 0).ToString()
并忘记变量总和