Skip to main content

Big Scare


I learned an important lesson. Actually, I learned a few lessons. The first lesson - always back up. Have copies of files if backing up isn't easy. Next, it's a good idea to not proceed too far without checking to make sure everything still work, while you can still undo something. Third, and more specifically, apparently, renaming certain items in Visual Studio can completely erase a design. Let me explain...

To recap, Visual Studio is the IDE I use to write my programs. I'm learning the VB.Net programming language because that's the language the software my company maintains was written in. It makes sense to get more familiar with that. I'm still extremely new to Visual Studio, and I'm very new to coding and general coding principles. I'm reading tons of books (often at the same time) to get general coding practices, as well as very specific programming details for VB.Net. All this combined to say, I'm still learning, and I'm really new.

Now, I'm creating windows forms and writing the code to go along with them. I love creating the form itself, and that's the screenshot I showed in my previous blog post. I needed to do something I've never done before on this new pet project of mine. I needed to create a new Form within this solution. Luckily, I had watched demos during my meeting with all of developers a week ago how to add objects, and I managed to create one. Through creating subs before, I learned that case of letters was important. You'll see this error often.


Pretty much, Subroutines have to begin with a capital letter. This makes sense, but it's still somewhat conflicting. I've learned through the research I've done that when you name buttons, labels, and boxes in the designer, you name them with a lowercase prefix convention. For instance, my title "Detailing Calculator" is called lblTitle. This is fine for a label. For a button, however, you do the same thing (btnAngle1). So, to get to the code for that button, you can simply double-click and you're taken to it. The "rub" is that Visual Studio automatically renames the Subroutine the button you chose (which means my Subroutine was btnAngle1 - not BTNAngle1). So, I get the error. I got used to that and got rid of the errors. I simply renamed all of my Subroutines as they're created.

Now to the good stuff. When I created the form, the prefix for the form is frm. Again, the Subroutine I renamed to FRMxxxx. Then, in this tree, I literally renamed the Subroutine FRMAngle. I noticed that my DetailingCalculator.vb wasn't following the same prefix, so I decided to fix that.







I decided to rename the Public Class to FRMDetailingCalculator. Apparently in doing this, it completely erased and trashed my design. I panicked for a while that night, and eventually gave up. I didn't even realized it happened. But it did. 







I got with one of the developers here at work the next day over a Skype call. He had me look in the recycling bin and restore the .resx file and other DetailingCalculator file from there to the folder all of the other project data was stored in. I restarted Visual Studio, and all is well again.

So, to sum up. Have a backup copy. I was very fortunate to have the files still in the recycling bin, and even more fortunate to have someone walk me through how to restore it. Another big thing I need to make sure I study up on is some basic practices when it comes to naming conventions, classes, etc. 

Updated Resources

I've been reading a great book called Learning Visual Basic .Net by Jesse Liberty. You can get the Kindle download from Amazon here for just over $15. It's very specific and detailed from what I've seen so far, and I'm hoping it's going to take some of the mystery out of the programming and coding practices.

In addition to this, I'm listening to an Audio Book from Audible called Soft Skills: The Software Developer's Life Manual by John Sonmez. Audible is great, but if you want the book, Amazon has it here. I'm also reading The Software Craftsman by Sandro Mancuso. My company bought that book, and we have monthly meetings to discuss what's been read so far. Link to it is here. Finally, I've been reading a book on the side by Robert C. Martin (a very well-known coder) who has a blog titled "Clean Coder" you can get to here. The book I'm reading by him is called The Clean Coder: A Code of Conduct for Professional Programmers. The link to that book is here

At first, when I stepped back, this seemed like an overwhelming amount of material to read. Mind you, the only books I listed are the ones related to programming; I'm also reading the Benjamin Franklin biography on the side, but at a very slow pace. The more I thought about it, the more I realized that this is very similar to the way school is done. There are a multitude of subjects learned at one time, and usually, it opened new ways of thinking about those subjects when all of the learning happened at once. Besides that, each book teaches a different area. The book Learning Visual Basic .Net book is very detailed and gets into extreme specifics, which is important. Soft Skills is a much, much broader book. Rather than focus on programming specifically, this teaches how to handle a career and be successful at programming. The book Clean Coder is a little broader, but has some real technical skills involved; it complements Software Craftsman very well. Many of the ideas overlap, but at the same time, a very broad area is covered.

Comments

Popular posts from this blog

Starting the Path

Where did it all begin? To start, I love computers. I always have. The technology in them and around us is intimidating to say the least. There are many things I would do differently and wish could be done differently. So, why not me? I decided to actually try computers more than what I had in the past. I can troubleshoot and setup computers with some basic concepts. I couldn't build one from scratch, but then again, I never tried. I loved computers, but it was my hobby. I was afraid that if I turned my hobby into a career, I would lose my hobby because I wouldn't want to mess with computers outside of work. Eventually, you just have to get past that and try it out. I had been in Customer Service for over a decade. I excelled quickly in that department, but it became very clear after several efforts that I was simply not going to move forward in that department. Though I had advanced most of their technology from the first year I was there, created and wrote several poli

Time Management

Codefighting Progress Okay, first, if you're not following my other blogs, it's worth noting that I'm simultaneously studying to become a pilot. I had no idea the time it's going to take to study everything for the flight school. The amount of information covered is insane and demanding. I'm going to keep both up, but not nearly at the pace I had initially hoped. The actual ground school lasts 12 weeks, and then I take a written test. I'll have to get actual flight time in and eventually take the flight test within 2 years to be a full blown pilot. That being said to iterate how much my focus will be divided briefly, but I will come back more focused to this task at hand. I'm in the 2nd week of the 12 week close so only 2 1/2 months left, then my flying time is only on the weekends. I'll figure out how to do that. As far as the what I've been doing lately, well, I haven't progressed further than the 2nd chapter in the book. In my spare

Progress on the Pet Project

So, I don't have much, but I do have some. Behold my genius code for my hours calculation:     Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click         Dim s1 As Integer         Dim s2 As Integer         Dim s3 As Integer         Dim s4 As Integer         s1 = Val(txtTimeInSunday.Text)         s2 = Val(txtTimeOutLunchSunday.Text)         s3 = Val(txtTimeInLunchSunday.Text)         s4 = Val(txtTimeOutSunday.Text)         lblSundayHoursTotal.Text = s4 - s1 - (s3 - s2)         Dim m1 As Integer         Dim m2 As Integer         Dim m3 As Integer         Dim m4 As Integer         s1 = Val(txtTimeInMonday.Text)         s2 = Val(txtTimeOutLunchMonday.Text)         s3 = Val(txtTimeInLunchMonday.Text)         s4 = Val(txtTimeOutMonday.Text)         lblMondayHoursTotal.Text = m4 - m1 - (m3 - m2)         Dim t1 As Integer         Dim t2 As Integer         Dim t3 As Integer         Dim t4 As Integer         s1 = Val(txtTime