WEBINAR:On-Demand

Introduction

The world is becoming lazier. It gets easier to do certain tasks, and certain previously tedious tasks now get done for us. Technology is great! With new technology comes new solutions, as in the case of today's topic. Yes, TinyURL has been around a very long time, but you may not have heard about it before, or, you may have been wondering how to shorten your long URLs quickly as TinyURL does. Today, I will show you. It is quite easy and not a lot of work, so let's get started, shall we?

Practical

Create a new C# or Visual Basic.NET Windows Forms Application and design your form to resemble Figure 1.

The ShrinkURL function generates a shortened URL with the help of the 'api-create' method in its URL. You supply the long URL that was entered in one of the Textboxes; then, you need to create WebRequest objects to obtain the returned shortened URL and a StreamReader object to interpret the URL and return a properly formed string to be returned to the calling method or procedure.

The Process button waits a second, and then adds the shrunken URL to the Output Textbox. The Copy button simply copies the URL to the Clipboard.

Figure 2 shows a long URL that was entered. Figure 3 shows the shortened URL.

Figure 2: Long URL

Figure 3: Short URL

Conclusion

Quick and dirty. I just want to thank everyone for reading my articles. Some articles are quite long, some are short, but I do hope you benefit from them. My aim with these articles is to help you learn funky tricks, or interesting things, or simply learn something new. I know what it is like to struggle and not know what to do and where to go and what to look for. CodeGuru has helped so much! I just hope my ideas and my experience help you as well.

About the Author

Hannes DuPreez

Hannes du Preez is an ex MVP for Visual Basic from 2008 to 2017. He loves technology and loves Visual Basic and C#. He loves writing articles and proving that Visual Basic is more powerful than what most believe. You are most welcome to reach him at: ojdupreez1978[at]gmail[dot]com

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.

Thanks for your registration, follow us on our social networks to keep up-to-date