How do you determine if an Internet connection is available for your WinForms App?

前端 未结 8 801
生来不讨喜
生来不讨喜 2020-12-24 15:33

What is the best way to determine whether there is an available Internet connection for a WinForms app. (Programatically of course) I want to disable/hide certain functions

8条回答
  •  时光说笑
    2020-12-24 16:13

    http://www.csharphelp.com/archives3/archive499.html

    Also, scroll past the experts-exchange links at: http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=13045, and you'll see some suggestions.

    Also, if you are game for the My namespace from VB.Net (which you can link to, btw), My.Computer.Network.IsAvailable is the simplest solution.

提交回复
热议问题