Not sure of how to resolve this error... See below...
VB Code:
Dim btnZero As Integer = 0 Dim btnOne = 1 Dim btnTwo = 2 Dim btnThree = 3 Dim btnFour = 4 Dim btnFive = 5 Dim btnSix = 6 Dim btnSeven = 7 Dim btnEight = 8 Dim btnNine = 9 Dim intCounter As String = 0 Dim numberArray() As String Dim comboString As String Dim myDec As Decimal Private Sub btnDecimal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDecimal.Click 'The purpose of the code below is to store button clicks into an array as a 'string so they can be joined and viewed in a rich text box. The below button 'is for the decimal. I thought I could store it in the array and then convert 'the string number, including the decimal as a number... so I could do 'calculations. ReDim Preserve numberArray(intCounter) Dim btnDecimal As String = "." numberArray(intCounter) = btnDecimal rtbScreen.Text = numberArray(intCounter) intCounter = intCounter + 1 Console.WriteLine("The Decimal button was pressed") Console.WriteLine("intCounter =" & intCounter) comboString = String.Join("", numberArray) Console.WriteLine("Value of comboString =" & comboString) myDec = Convert.ToDecimal(comboString) 'Here is my error rtbScreen.Text = comboString End Sub
Thanks,
Joe




Reply With Quote