Skip to main content

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(txtTimeInTuesday.Text)
        s2 = Val(txtTimeOutLunchTuesday.Text)
        s3 = Val(txtTimeInLunchTuesday.Text)
        s4 = Val(txtTimeOutTuesday.Text)
        lblTuesdayHoursTotal.Text = t4 - t1 - (t3 - t2)

        Dim w1 As Integer
        Dim w2 As Integer
        Dim w3 As Integer
        Dim w4 As Integer
        s1 = Val(txtTimeInWednesday.Text)
        s2 = Val(txtTimeOutLunchWednesday.Text)
        s3 = Val(txtTimeInLunchWednesday.Text)
        s4 = Val(txtTimeOutWednesday.Text)
        lblWednesdayHoursTotal.Text = w4 - w1 - (w3 - w2)

        Dim th1 As Integer
        Dim th2 As Integer
        Dim th3 As Integer
        Dim th4 As Integer
        s1 = Val(txtTimeInThursday.Text)
        s2 = Val(txtTimeOutLunchThursday.Text)
        s3 = Val(txtTimeInLunchThursday.Text)
        s4 = Val(txtTimeOutThursday.Text)
        lblThursdayHoursTotal.Text = th4 - th1 - (th3 - th2)

        Dim f1 As Integer
        Dim f2 As Integer
        Dim f3 As Integer
        Dim f4 As Integer
        s1 = Val(txtTimeInFriday.Text)
        s2 = Val(txtTimeOutLunchFriday.Text)
        s3 = Val(txtTimeInLunchFriday.Text)
        s4 = Val(txtTimeOutFriday.Text)
        lblFridayHoursTotal.Text = f4 - f1 - (f3 - f2)

        Dim sa1 As Integer
        Dim sa2 As Integer
        Dim sa3 As Integer
        Dim sa4 As Integer
        s1 = Val(txtTimeInSaturday.Text)
        s2 = Val(txtTimeOutLunchSaturday.Text)
        s3 = Val(txtTimeInLunchSaturday.Text)
        s4 = Val(txtTimeOutSaturday.Text)
        lblSaturdayHoursTotal.Text = sa4 - sa1 - (sa3 - sa2)


    End Sub

It's very crude, probably, but it's somewhat working. It's not giving me any more data than Sunday's total hours. Not sure why. Going to ask or research some on that part.

But, check it out! Actual living, breathing program!


When you click the Calculate button, it's supposed to calculate the Daily Total and Actual Hours. Then, it compares those to the Scheduled Hours, and if you meet or exceed those hours, you'll get a big grinning happy picture or something like that on the right. If not, some sad face. It's progress! And it's exciting! :D

Now, I'm aware that there is very likely an infinitely much easier method of calculating the hours. For a first attempt, and to see the math and everything involved, though, I am very proud.

Comments

Popular posts from this blog

New Pet Project

Okay, I've got my next great idea for my pet project. It's a little more complicated, but not terribly. My biggest complaint I had when I transferred from the Detailing Department to the Customer Service department was the loss of my trusty HP48G calculator. This thing was awesome! You calculated feet and inch calculations with formulas. The format was feet.inches and sixteenths. For instance, 14.0608 = 14'-6 1/2". The formulas removed parts of the inputted number and converted them from a foot to a number to add and subtract, and then reconverted the number to a foot answer to display. I and a colleague created several excel sheets that essentially did the same thing, but it just wasn't convenient and didn't flow very well. So, I'm going to create a program that looks close to this calculator. In addition to the addition, subtraction, multiplication, and division of feet-inch numbers, there were formulas that calculated roof slopes, weights, and...

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...

Pet Project Progress

Well, I've started my pet project, and I've got a GUI laid out. It's a little slow going, but it should work well in the end, I think. I'm sure there's going to be lots of feedback and many different ways I could do things. Right now, however, I'm limited to what I am learning in the text. As promised, here's the screenshot of my first program. Help? I'm trying not to ask too many people how to write any of the code yet for a couple of reasons. First, I haven't learned any code yet, and I likely won't understand a word of what's being told to me. Second, I'm afraid that what I'll be told I'll understand at that moment, but since I didn't have to work  for it, it won't get burned into my memory like the knowledge I have to seek out. Those long hours searching usually scar you to the point you never want to forget those lessons again. Function Since I don't have too much to show, I'll just explain what th...