what am i missing?

sarahaf04 41 Reputation points

179185-06920685-1567-46ee-aa3f-352b0674d602.pngthis is a conversion converter. when i enter 2, im supposed to have output values, not zeros... someone help please

Public Class Form1

Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click    
    ' Declare variables    
    Dim decYard As Decimal  ' Yard amount from txtYard    
    Dim decFeet As Decimal  ' Feet    
    Dim decInches As Decimal ' Inches    
    Dim decCentimeters As Decimal ' Centimeters    

    Const decFEET_FACTOR As Decimal = 3.0    
    Const decINCHES_FACTOR As Decimal = 36.0    
    Const decCENTIMETERS_FACTOR As Decimal = 91.44    

        ' Calculate and display Yards to Feet    
        decFeet = decYard * decFEET_FACTOR    
        lblFeet.Text = decFeet.ToString("n")    

        ' Calculate and display Yards to Inches    
        decInches = decYard * decINCHES_FACTOR    
        lblInches.Text = decInches.ToString("n")    

        ' Calculate and display Yards to Centimeters    
        decCentimeters = decYard * decCENTIMETERS_FACTOR    
        lblCentimeters.Text = decCentimeters.ToString("n")    

    Catch ex As Exception    
        MessageBox.Show("Please enter numeric values", "Error detected in input")    
    End Try    

End Sub    

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click    
    ' Close the form    
End Sub    

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click    
    txtYard.Text = String.Empty    
    lblFeet.Text = String.Empty    
    lblInches.Text = String.Empty    
    lblCentimeters.Text = String.Empty    

    ' Set the focus to txtYard    
End Sub    

End Class

An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,594 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 26,996 Reputation points Microsoft Vendor

    Hi @sarahaf04 ,
    You forget decYard = txtYard.Text
    Best Regards.
    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments