Help with some Visual Basic Programming. Please.

PHP:
    Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDone.Click
        Dim num_yes As Integer
        Dim num_no As Integer

        If rbQ1y.Checked Then num_yes += 1 Else If rbQ1n.Checked Then num_no += 1
        If rbQ2y.Checked Then num_yes += 1 Else If rbQ2n.Checked Then num_no += 1
        If rbQ3y.Checked Then num_yes += 1 Else If rbQ3n.Checked Then num_no += 1
        If rbQ4y.Checked Then num_yes += 1 Else If rbQ4n.Checked Then num_no += 1
        If rbQ5y.Checked Then num_yes += 1 Else If rbQ5n.Checked Then num_no += 1

        Dim result As String
        result = IIf(num_no <= 2, "Optimist", "Pessimist")
        txtResults.Text = String.Format("Yes Answers: {0}, No Answers: {1} - {2}!", num_yes, num_no, result)


    End Sub

rbQ1n = question 1 no
rbQ1y = question 1 yes
etc

Something like this will work. Read more VB books/websites :p.
 
Have a look over that code and make sure that you understand it all. Just set yourself some nice easy projects to help you learn and make sure that you read some books on vb .net.

Everyone who is saying that you are just cheating are probably right but in the end, if you dont understand it then you will be found out at some point. You could have all the qualifications in the world but if you can't actually program then someone will notice. Good luck with the unit mate and just keep trying.

If you have trouble in the future feel free to post on here but id try and show that you have made an effort coding it yourself and dont leave it till the night before the deadline ;)
 
Back
Top Bottom