mardi 22 mars 2016

Converting String to Boolean Value .net

I'm making a Student Information System where a student can enter their results and calculate their final grade overall. In the group box "Project Results" students enter their project results out of 50 and their percentage is calculated in TextBox1.

However, I want to include checkboxes to suit certain conditions; e.g If checkbox2 is checked this means the project was submitted 7 days late = 10 % deduction in the final grade. I've completed the following code but am having a run time error of:

Conversion from string "TrueTrue" to type 'Boolean' is not valid

enter image description here

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim a As Integer
    Dim b As Decimal

    If IsNumeric(TextBox3.Text) & CheckBox2.Checked.ToString Then
        If TextBox3.Text <= 20 Then
            a = (TextBox3.Text * 100) / 20
            TextBox4.Text = a
            b = a * 0.1 - 0.1

            TextBox5.Text = CDec(b)




        Else
            MsgBox("Please Enter value equal to 20 and below!")
        End If
    End If

I'm wondering how I can convert a Boolean value to a String, or even if there is a better of way of completing my task?




Aucun commentaire:

Enregistrer un commentaire