I am doing a simple calculator program. I have a combo box and assigned numerical values to a string variable under each case number using the same variable name. My problem is I don't know how to assign that value. When I use the current code, it pulls the value of the case select number rather than the assigned value. I suspect the problem is my string variable assignment. Any help would be greatly appreciated. Here is some of the code...
Dim strSelection As String Dim decSelection As Decimal 'Assign value to variables strSelection = cboConversionType.SelectedIndex.ToString() 'Check to make sure selection is made If cboConversionType.SelectedIndex >= 0 Then 'Convert value to decimal decSelection = Convert.ToDecimal(strSelection) Else 'Display error message End If 'Calculate Results decAnswer = decQuantityEntered * decSelection 'Assign numerical values according to which case is selected Select Case cboConversionType.SelectedIndex Case 0 strSelection = 25 Case 1 strSelection = 30 Case 2 strSelection = 35 End Select
Edited 4 Years Ago by peter_budo: Keep It Clear - Do use code tags when posting any code