Dunkey
Dunkey

Reputation: 1922

VB.Net grade distribution exercise

So I really need help in doing this exercise. The user has to input a grade, and after typing the grade in txtGrade, it will be distributed in four textboxes.

For example, the user inputs 50 in txtGrade.

The output should be:

CS: 20
IT: 10
EX: 10
EM: 10

The order is not necessary.

So this is what I have tried:

 Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
    txtA.Text = txtGrade.Text
End Sub

But I can't seem to think of how to distribute it to other textboxes.

Upvotes: 0

Views: 199

Answers (1)

bgs
bgs

Reputation: 3223

Try this

If txtGrade.Text <> "" Then
    If CDbl(txtGrade.Text) Then
    texCS.Text = (CDbl(txtGrade.Text) * 40 ) / 100
    texIT.Text = (CDbl(txtGrade.Text) * 20 ) / 100
    texEX.Text = (CDbl(txtGrade.Text) * 20 ) / 100
    texEMP.Text = (CDbl(txtGrade.Text) * 20 ) / 100
    End If

End If

Upvotes: 1

Related Questions