Question: hello i am stuck writing a code in visual basics. i keep getting an error message and i dont know how to fix it. the
hello i am stuck writing a code in visual basics. i keep getting an error message and i dont know how to fix it. the error message reads " structure 'double' cannot be indexed because it has no default propert" im not sure what that means.
Option Strict On Public Class InchesToMetric Private Sub MillimetersButton_Click(sender As Object, e As EventArgs) Handles MillimetersButton.Click
Dim Inches As Double ' To hold the inches Dim Millimeters As Double ' To hold the millimeters
Try ' Get the inches. Inches = CDbl(InchesText.Text)
' Convert inches to millimeters. Millimeters = INCHESTOMM(Inches)
' Display the result. MessageBox.Show(Inches.ToString() & " inches equals " & Millimeters.ToString() & " millimeters.") Catch ' Display an error message for invalid input. MessageBox.Show("Error: Enter a numeric value.") End Try
End Sub
this is the module that i want it to get the information from
Option Strict On Module MathModule
' Constants for the meters to English conversion factors Public Const METERSTOINCHES As Double = 39.37 Public Const METERSTOFEET As Double = 3.28 Public Const METERSTOYARDS As Double = 1.09
' Constants for the inches to metric conversion factors Public Const INCHESTOMM As Double = 25.4 Public Const INCHESTOCM As Double = 2.54 Public Const INCHESTOMETERS As Double = 0.0254
' The MetersToInches function accepts a number of meters as ' an argument and returns the equivalent number of inches. Public Function MetersToInchesReturn(ByVal Meters As Double) As Double Return Meters * METERSTOINCHES End Function
' The MetersToFeet function accepts a number of meters as ' an argument and returns the equivalent number of feet. Public Function MetersToFeetReturn(ByVal Meters As Double) As Double Return Meters * METERSTOFEET End Function
' The MetersToYards function accepts a number of meters as ' an argument and returns the equivalent number of yards. Public Function MetersToYardsReturn(ByVal Meters As Double) As Double Return Meters * METERSTOYARDS End Function
' The InchesToMM function accepts a number of inches as ' an argument and returns the equivalent number of millimeters. Public Function InchesToMMReturn(ByVal Inches As Double) As Double Return Inches * INCHESTOMM End Function
' The InchesToCM function accepts a number of inches as ' an argument and returns the equivalent number of centimeters. Public Function InchesToCMReturn(ByVal Inches As Double) As Double Return Inches * INCHESTOCM End Function
' The InchesToMeters function accepts a number of inches as ' an argument and returns the equivalent number of meters. Public Function InchesToMetersReturn(ByVal Inches As Double) As Double Return Inches * INCHESTOMETERS End Function End Module
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
