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

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

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




sub and function procedure

 
Reply to this topicStart new topic

sub and function procedure

pomak
23 Nov, 2008 - 12:09 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


AdamSpeight2008
RE: Sub And Function Procedure
23 Nov, 2008 - 12:33 PM
Post #2

The Bandido Coder
Group Icon

Joined: 29 May, 2008
Posts: 1,654



Thanked: 99 times
Dream Kudos: 3350
Expert In: vb.net, LINQ

My Contributions
Deja Vu
User is offlineProfile CardPM
+Quote Post

pomak
RE: Sub And Function Procedure
23 Nov, 2008 - 01:09 PM
Post #3

New D.I.C Head
*

Joined: 1 Nov, 2008
Posts: 22


My Contributions
QUOTE(AdamSpeight2008 @ 23 Nov, 2008 - 12:33 PM) *



what is deja vu
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

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

Live VB.NET Help!

Be Social

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

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month