Skip to main content

Posts

Settings in C# and other lessons learned while converting from VB.Net

  I started converting some of my VB.Net code to C# and have learned a few things. Reading settings was my first stumbling block as there was a lot of incorrect information on the internet. I did finally get it to work and will summarize here. I have a small application that loads engineering data into a SQL database. The files are basic text files with either XML or comma separated values. I store a few variables, such as path, file type, etc, in the app.config file. In VB it is simple to pull this info: Path = My.Settings.Folder In C#, the code is a little different. Here is my final working code for the above example:  Path = [NameSpace].[AppName].Properties.Settings.Default.Folder; For me, using the This keyword did not work. I have also been using this website to convert each Method from VB to C# and have found it very helpful: http://converter.telerik.com/ A couple of other items that tripped me up are all arrays need brackets, instead of parentheses. Also when...

Holding Hands

Walking side by side and holding hands, We know where we are headed. Together, we are strong with your delicate fingers wrapped in mine. Holding hands we will travel, laugh and love our life together. My hand in yours will always be. Your hand in mine until the end of time. © 2011 Wade Brooks I gave this poem to my wife, Sandi, on our 20th wedding anniversary. Cheers, Wade Image by my friend Thomas Hawk

Stock Price To File Example – VB.NET 2010

  I created this application to write the current real time stock price to our intranet server. The application uses Google’s stock price API. The resulting XML file is parsed for the price and volume which is then saved to the local web server as a text file to be included in a web page. The code retrieves the stock price every five minutes and then saves a file to the server. The code also updates the line chart with the price. VB.NET source code can be found here: https://drive.google.com/open?id=0BxXnsiUlViylYTY4eFctUURwdWs

VB.NET Zip UnZip Example

I made an example VB.Net 2010 application to show how to zip and unzip files using the SharpZipLib.DLL. The application uses the library to zip and unzip a file. Source code can be found here: https://drive.google.com/file/d/0BxXnsiUlViylclFFVnEtbWgwMnc/view?usp=sharing   (115 KB) A compiled executable can be found here: https://drive.google.com/file/d/0BxXnsiUlViylSldJdzY5bmJ2QVE/view?usp=sharing  (95 KB) Information on the SharpZipLib.DLL can be found here: http://icsharpcode.github.io/SharpZipLib/