VB.NET Launch URL From Application Using Default Browser

vb2Do you need to launch a URL from within your application? Maybe using the users default browser using a button, label or other control? Forget using the “LinkLabel” control and use two lines of code instead and save yourself a ton of headaches!

This is a classic example of Microsoft trying to make something better/faster/easier for us developers and instead making things harder. If you need to insert a control like a label in your app and have it spawn a browser heading to a web page at the click of a mouse, you would most likely reach for the LinkLabel control just from the name of it, right? That’s what I did at first and what a nightmare can of worms did I open up there.

OK, it wasn’t that bad but still, using the LinkLabel control is a complicated mess in my opinion, and doing it this way is much easier for me, so I thought that I would just have to share with everyone of you readers out there. (Yeah, both of you!)

I am not going into how to use the LinkLabel control, and to be sure it is more feature full than just using one control for one link, but my needs are simple. :) Basically, the easiest way to kick off a browser heading to the website of your choice is to use the “Process.Start” method. This makes the URL in question open in the users default browser, which is a good thing because applications that spawn Internet Explorer to open a URL instead of my default browser really annoy me. To the point where I sometimes remove said application depending on how bad I want what it is supposed to do.

Anyway, add your button or label or whatever and open the code view using the “Click” event. Then add these two lines of code:

Dim url As String = "http://www.solarum.com/"
Process.Start(url)

And it’s just that easy! I mean, the possibilities are endless, you can fire these two lines off from darn near anywhere using almost any control. I am sure you will want to use your own URL in there but feel free to link to Solarum anywhere you like! Check it out, play with it and have some fun. I hope this has helped or will help you out some day, enjoy!!

Windows Restore Point Creator

system_restoreWe all know what a useful tool the Windows System Restore Point can be for fixing problems that inevitably crop up from time to time, and we also know what a pain it is to create a System Restore Point manually just for good measure. So, let me share with you this application that I found a while back and have been using and testing called (aptly enough) Restore Point Creator! This tool is way cool to have around because it make creating System Restore Points quick and easy, and gives you a look at the list of your most recent Restore Points, when they were created and so on. Best of all, aside from it’s most useful features, it is completely free of charge though a donation to the author wouldn’t hurt your karma any. Check it out and see what you think for yourself.

Arduino, wow, cool stuff!

arduino_logo2I have recently become familiar with the Arduino project, an open source board and CPU design for hobbyists and beyond to build all sorts of neat things with. I have seen people build robots, remote controlled lawn mowers, music playing computer hardware and all kinds of things. I got myself one of these nifty boards because they are wicked cool to work with and not expensive at all. If you are into electronics, and/or love to or want to learn to code (in C and C++) then I highly recommend getting one of these boards and going to town. Being an open source project there are lots of resources on the web, and there is tons of information practically everywhere. I’ll be sharing what I know and learn and what I run into that helps like books and stuff. So stay tuned and come back to see what new pops up.

arduino

WordPress Security: Nulled Scripts and the CryptoPHP Infection

wflogoIt seems that our good friends at Wordfence Security have come across some very important security information from Fox-IT in the Netherlands about WordPress (also affecting Drupal and Joomla), Nulled Scripts, and a security hole dubbed CryptoPHP included in infected themes and plugins. This security hole effectively turns infected websites into botnet slaves, it’s really very fascinating. Take a look, if you work with WordPress, Joomla, Drupal or PHP at all or are just curious you ought to read it. It’s a well written article and very interesting, check it out.

Shotened URL: http://solarum.com/v.php?l=1420wb71

The Heartbleed Bug – Start Patching Now!

heartbleedThere is a new vulnerability out there in OpenSSL called The Heartbleed Bug, and it’s a doozy. Imagine someone compromising your network, or SSL protected website or service, stealing your private and thought secure information – all without leaving a trace that they had even been there! This is one vulnerability that is really bad, and if you have any systems that might be affected you should start updating them right away! Read more about The Heartbleed Bug here.

VB.NET Color Dialog Return String Value

Here recently I have been working more and more with Visual Studio again, and more specifically the Color Picker / Color Dialog control. For my purposes, I wanted the user to pick a color, and that color to then populate a text box in the form of an HTML compliant hex value, in other words, I need the result from the color picker as a string. Now, in VB.NET 2010 which is what I am using, the result from the color picker is in a format that is primed and ready to apply to a control, to change its fore or back round color. It does not give you a value in string format. So, I had to do a good bit of searching and work to figure this out.

Basically, what I ended up with was a function that you run the color picker response or value through. It’s pretty simple really:

Public Function Color2Html(ByVal MyColor As Color) As String
  Return "#" & MyColor.ToArgb().ToString("x").Substring(2).ToUpper
End Function

That’s it, that will return to you a hex color code formatted for HTML use. Just in case you are unsure of exactly how to use the function, this is the code I use with my color picker control (I use a standard button to fire it off with the result going into a text box):

Private Sub btnColor1_Click(sender As System.Object, e As System.EventArgs) Handles btnColor1.Click
  Dim NewColor As New ColorDialog()
  NewColor.AllowFullOpen = True
  NewColor.ShowHelp = True
  If (NewColor.ShowDialog() = Windows.Forms.DialogResult.OK) Then
    txtColor.Text = Color2Html(NewColor.Color)
  End If
End Sub

That’s all there is too it. I hope this helps you get your string data from your Color Dialog / Color Picker control. Enjoy!