Showing posts with label fahrenheit to celsius in visual basic net. Show all posts
Showing posts with label fahrenheit to celsius in visual basic net. Show all posts

Tuesday, June 3, 2014

Fahrenheit To Celsius Converter in Visual Basic NET

Software becomes the driving force of information technology at present time, most of us are very dependent on software in doing our day to day task or work.  For example if you are an office clerk your main job is to prepare the documents, worksheet and presentation for instance we need to use a complete application to do the work that we need. That's why we use Microsoft Office like ms work, ms excel and ms power point to do the job.  This software are very complex that it requires hundreds or even thousands of programmers to write this application. It also evolves many years of careful planning, design and development.  On the part of Microsoft Corporation they invest big amount of resources like money and facilities during the development of Microsoft Office applications before it will be released and sold in the market.

As a freelance developer I also encounter many challenging problems involving software design and development one of the most common problem is that the client or customer doesn't not have an adequate understanding about the real problem of their proposed information system that they are planning for me to developed. Another thing that I have observed once I was able to finish the system my client wants another features and changes for the system, if the changes related to my mistakes being a programmer I change it free from charge but if it related to features that are not included in an agreement that we have I charge them reasonable price for the services in programming.

In software design and development it is a must bust client and developer to set down and plan very well what are the needs, problems identified in the current system before the ball rolling in writing a code. Well organized planning will cut down the development time by half because the programmer can focus very well in solving the problem rather than thinking what are the additional problems to be solve in the proposed system whether the client needs a business application or system application this procedure is still applicable.  One of my close friend that is also a good application developer in Java told me during our college days solve first the problem before make some good design. I agree because once you solve the problem in algorithm it is easier for us to do the design.  I hope this advice that I shared with you will help you in your software development.


In this article I will discuss a simple program that I wrote in Microsoft Visual Basic .NET I called this program Fahrenheit To Celsius Solver. What this program will do is very simple it will ask the user to enter a value in Fahrenheit in our text box. By this time I gave the user the two option in solving the value of Celsius the first option is press the enter key and will give you the result in our label or the user can press the Solve Celsius button to get the result in the label in the form.  I also included a button to clear the label and the text box and finally the last button which enables the user to quit the program and return to our windows operating system. The code is very short and very easy to understand by beginning programmers in Visual Basic .NET.

Thank you very much.





Sample Output of Our Program

Program Listing

 Public Class frm_fahrenheit

    Private Sub txt_fahrenheit_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt_fahrenheit.KeyPress
        If e.KeyChar = ControlChars.Cr Then 'Enter key
            lbl_result.Text = "The temperature equivalent in Celsius is " & _
                ((CInt(txt_fahrenheit.Text) * 9) / 5) + 32 & " Cº."
        End If
    End Sub

  
    Private Sub btn_celsius_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_celsius.Click
        lbl_result.Text = "The temperature equivalent in Celsius is " & _
                ((CInt(txt_fahrenheit.Text) * 9) / 5) + 32 & " Cº."
    End Sub

    Private Sub btn_clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_clear.Click
        txt_fahrenheit.Clear()
        lbl_result.Text = " "
        txt_fahrenheit.Focus()
    End Sub

    Private Sub btn_quit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_quit.Click
        If MsgBox("Are you sure you want to quit?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "Quit Program?") = MsgBoxResult.Yes Then
            Me.Hide()
        Else
            Me.Show()
            txt_fahrenheit.Clear()
            lbl_result.Text = " "
            txt_fahrenheit.Focus()
        End If
    End Sub
End Class