How To Use API In VB.Net

 We Will See How To Implementing API In Visual Basic.NET (VB.NET) In This Post

Steps :

Create A New  VB.Net Project Using Microsoft Visual Studio. Add 2 Label , 2 TextBox ['myurl' for accepting link from user and 'outputurl' for showing short link] and 2 Buttons As Shown Below

When We Will Click On 'Short URL' Button , The Program Is Supposed To Check Whether Their Is Internet Connection Available Or Not As It Will Require Network While Using API. So If Their Is No Internet Connection Available , It Will Show A Message That You Don't Have An Active Connection And The Process Will Terminate Their. Use Following Code For This Purpose.


After That We Have To Check That Whether The TextBox [Named As 'myurl'] Is Blank Or Not. If It Is Blank , Then We Have To Show A Message Something Link Enter Any Link To Short The Link. If There Is Already Any Link There In 'myurl' TextBox , Then We Will Proceed To Short The Link Using API As We Have Done In PHP  API :

 Replace 'your_url_here' With Your Desired Link


Now For 'Copy Code' Button , We Will Again Check That The Output TextBox [Named 'outputurl'] Must Not Be Blank. After That We Will Copy Its Text By SelectAll() & Copy() Function


In This Way , We Can Create Our Own Link Shortener Of Using API In VB.NET

Complete Code :