Vb.net 具有相同签名的多个定义
你在评论中得到了答案,但只是想解释一下,以确保你明白你能做什么和不能做什么 当你创建一个方法时,你可以给它命名,这样当你调用它时,你的程序就知道你想调用哪个方法。当您以相同的方式命名两个方法时,它不知道在调用时使用哪一个Vb.net 具有相同签名的多个定义,vb.net,Vb.net,你在评论中得到了答案,但只是想解释一下,以确保你明白你能做什么和不能做什么 当你创建一个方法时,你可以给它命名,这样当你调用它时,你的程序就知道你想调用哪个方法。当您以相同的方式命名两个方法时,它不知道在调用时使用哪一个 拥有两个同名方法的唯一方法是,如果它们具有不同的“签名”,这意味着它们不能100%相同。不同的参数将使方法的签名不同,即使它们被称为相同的,那么…你的问题是什么?你有2个客户端下载文件已完成事件-你没有看到它们吗?你不能那样做!很抱歉我刚学会VB:( Dim WithEvent
拥有两个同名方法的唯一方法是,如果它们具有不同的“签名”,这意味着它们不能100%相同。不同的参数将使方法的签名不同,即使它们被称为相同的,那么…你的问题是什么?你有2个
客户端下载文件已完成
事件-你没有看到它们吗?你不能那样做!很抱歉我刚学会VB:(
Dim WithEvents client As New WebClient
Private Sub DirectX9ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DirectX9ToolStripMenuItem.Click
Try
client.DownloadFileAsync(New Uri("http://download1588.mediafire.com/y9phz64wph4g/aqlp1m71mvuwo74/Direct+X+11+Update.rar"), "C:\Documents and Settings\All Users\Documents\Direct X 11 Update.RAR")
Catch ex As Exception
MsgBox("File already exists or is corrupted!")
End Try
End Sub
Private Sub client_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) Handles client.DownloadFileCompleted
MsgBox("Direct X 9 has been successfully downloaded!", MsgBoxStyle.Information)
Label48.Visible = False
Label49.Visible = False
ProgressBar3.Visible = False
Label48.Text = "0 &"
Label49.Text = "0 / 0"
ProgressBar3.Value = 0
End Sub
Private Sub client_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles client.DownloadProgressChanged
Label48.Visible = True
Label49.Visible = True
ProgressBar3.Visible = True
Label48.Text = ProgressBar3.Value & "%"
Label49.Text = e.BytesReceived & " / " & e.TotalBytesToReceive
ProgressBar3.Value = e.ProgressPercentage
End Sub
Private Sub GeForceExperienceV2000ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles GeForceExperienceV2000ToolStripMenuItem.Click
Try
client.DownloadFileAsync(New Uri("http://download903.mediafire.com/w91mlqdf6clg/a540a35f5ddcpbn/GeForce_Experience_v2.2.2.0.exe"), "C:\Documents and Settings\All Users\Documents\GeForce_Experience_v2.2.2.0.exe")
Catch ex As Exception
MsgBox("File already exists or is corrupted!")
End Try
End Sub
Private Sub client_DownloadFileCompleted(sender As Object, e As AsyncCompletedEventArgs) Handles client.DownloadFileCompleted
MsgBox("GeForce_Experience_v2.2.2.0 has been successfully downloaded!", MsgBoxStyle.Information)
Label48.Visible = False
Label49.Visible = False
ProgressBar3.Visible = False
Label48.Text = "0 &"
Label49.Text = "0 / 0"
ProgressBar3.Value = 0
End Sub
End Class