国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
VB.NET下載程序代碼實(shí)現(xiàn)

對于VB.NET語言的應(yīng)用來說,其中有很多小技巧值得我們?nèi)フ莆?,來充?shí)我們的開發(fā)經(jīng)驗(yàn),以提高編程效率。比如VB.NET下載程序的實(shí)現(xiàn),就是其中一個(gè)很有用的編程技巧,能幫助我們很好的解決開發(fā)中所遇到的相關(guān)問題。

VB.NET下載程序代碼示例:

  1. Public Shared fpath As String  
  2. Dim fsize As Long  
  3. Private Sub Button1_Click(ByVal sender As System.Object, 
    ByVal e As System.EventArgs) Handles Button1.Click  
  4. Try  
  5. If Me.TextBox1.Text = "http://" Then  
  6. MessageBox.Show("請輸入正確的URL!")  
  7. Return  
  8. End If  
  9. Dim urld As String  
  10. Dim i As Integer  
  11. Dim dfile As New WebClient  
  12. Me.SaveFileDialog1.ShowDialog()  
  13. fpath = SaveFileDialog1.FileName  
  14. Label3.Text = "文件保存在:" & fpath  
  15. urld = Me.TextBox1.Text  
  16. Me.Timer1.Enabled = True 
  17. dfile.DownloadFile(urld, fpath.Substring
    (Me.TextBox1.Text.ToString.LastIndexOf("."), 4))  
  18. Me.Timer1.Enabled = False 
  19. Catch ex As Exception  
  20. MessageBox.Show(ex.Message)  
  21. Return  
  22. Application.Exit()  
  23. End Try  
  24. End Sub 
  1. Private Sub Timer1_Tick(ByVal sender As System.Object, 
    ByVal e As System.EventArgs) Handles Timer1.Tick  
  2. Dim th2 As New th1  
  3. Dim tt As New System.Threading.Thread(AddressOf th2.timeth) 
  4. '實(shí)例化線程類   
  5. tt.Start() '啟動(dòng)線程   
  6. Label2.Text = th2.downk '顯示下載文件的大小   
  7. '進(jìn)行計(jì)算下載速度   
  8. Static k As Integer  
  9. Dim p, downspeed  
  10. p = k 
  11. k = p + 1  
  12. p = k 
  13. Dim form As New DownLoad  
  14. Dim fileinfo As New System.IO.FileInfo(form.fpath)  
  15. downspeed = fileinfo.Length()  
  16. downspeeddownspeed = downspeed / p  
  17. Label4.Text = "當(dāng)前下載速度是" & downspeed & "k/m"  
  18. End Sub  
  19. End Class  
  20. Public Class th1  
  21. Public Shared downk As String  
  22. Dim form As New DownLoad  
  23. Dim fileinfo As New System.IO.FileInfo(form.fpath)  
  24. Dim fsize As Long  
  25. Public Sub timeth()  
  26. If fileinfo.Exists = True Then  
  27. fsize = fileinfo.Length()  
  28. downk = "以下載文件" & fsize & "k"  
  29. End If  
  30. End Sub  
  31. End Class 

VB.NET下載程序的相關(guān)代碼操作就為大家介紹到這里。

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
終于找到啦!在VB.NET中如何保存網(wǎng)頁
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服