Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,303 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 764 people online right now. Registration is fast and FREE... Join Now!




sun and function procedure

 
Reply to this topicStart new topic

sun and function procedure

pomak
23 Nov, 2008 - 12:01 PM
Post #1

New D.I.C Head
*

Joined: 1 Nov, 2008
Posts: 22


My Contributions
Hi everyone I need help with this home work i've been programing just for 2 months
I should code an application that convert temperature from celsius to fahrenheit and from fahrenheit to celsius
there should be two buttons
one button uses two independent subs procedures and the other button two function procedures
i've been doing this for hours and it does not work and also nothing is highlighted and i dont know what is wrong
here is my code



Option Strict On
Option Explicit On

Public Class Form1

Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub

Private Sub convert1Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles convert1Button.Click

Dim celsius As Decimal
Dim fahrenheit As Decimal

celsius = Decimal.Parse(celTextBox.Text)
fahrenheit = Decimal.Parse(fahTextBox.Text)

End Sub

Private Sub celsius(ByVal celsius As Decimal)

If celsius <> 0 Then
fahTextBox.Text = Convert.ToString(celsius * 1.8 + 32)
End If

End Sub

Private Sub fahrenheit(ByVal fahrenheit As Decimal)

If fahrenheit <> 0 Then
celTextBox.Text = Convert.ToString(fahrenheit - 32 / 1.8)
End If

End Sub
Private Sub convert2Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles convert2Button.Click

Dim celsius As Decimal
Dim fahrenheit As Decimal

celsius = Decimal.Parse(cel2TextBox.Text)
fahrenheit = Decimal.Parse(fah2TextBox.Text)

End Sub

Private Function celsius2(ByVal celsius As Decimal) As Decimal

If celsius <> 0 Then
fah2TextBox.Text = Convert.ToString(celsius * 1.8 + 32)
End If

End Function

Private Function fahrenheit2(ByVal fahrenheit As Decimal) As Decimal

If fahrenheit <> 0 Then
cel2TextBox.Text = Convert.ToString(fahrenheit - 32 / 1.8)
End If

End Function
End Class


User is offlineProfile CardPM
+Quote Post


ShadowKyogre
RE: Sun And Function Procedure
23 Nov, 2008 - 12:03 PM
Post #2

New D.I.C Head
*

Joined: 11 Nov, 2008
Posts: 19

Number one: Please use the code tags!
CODE
Hi!

The code tags are [ code ] [ /code ] (w/o the spaces)
Then I'll help you. Also, this belongs in VB.Net

This post has been edited by ShadowKyogre: 23 Nov, 2008 - 12:06 PM
User is offlineProfile CardPM
+Quote Post

pomak
RE: Sun And Function Procedure
23 Nov, 2008 - 12:56 PM
Post #3

New D.I.C Head
*

Joined: 1 Nov, 2008
Posts: 22


My Contributions
ok put the tags and posted in VB.NET
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 05:47PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month