This code defines a class that inherits from System.Web.UI.Page. It contains code to calculate a percentage based on values from two text boxes, then assigns a letter grade (O, A, B, C, D, or F) to a label based on the percentage. It also adds the calculated grade to a list box when a button is clicked and allows removing a selected item from the list box with another button.
This code defines a class that inherits from System.Web.UI.Page. It contains code to calculate a percentage based on values from two text boxes, then assigns a letter grade (O, A, B, C, D, or F) to a label based on the percentage. It also adds the calculated grade to a list box when a button is clicked and allows removing a selected item from the list box with another button.
This code defines a class that inherits from System.Web.UI.Page. It contains code to calculate a percentage based on values from two text boxes, then assigns a letter grade (O, A, B, C, D, or F) to a label based on the percentage. It also adds the calculated grade to a list box when a button is clicked and allows removing a selected item from the list box with another button.
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Label2.Text = (Convert.ToDouble(TextBox5.Text) / Convert.ToDouble(TextBox6.Text) * 100).ToString() Dim percent = Convert.ToDouble(Label2.Text) If (percent >= 70) Then Label3.Text = "O Grade"
else if (percent>=60) then
Label3.Text = "A Grade" ElseIf (percent >= 55) Then Label3.Text = "B Grade" ElseIf (percent >= 50) Then Label3.Text = "C Grade" ElseIf (percent >= 40) Then Label3.Text = "D Grade" Else Label3.Text = "F Grade" End if ListBox1.Items.Add(TextBox2.Text + " " + Label3.Text)
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ListBox1.Items.Remove(ListBox1.SelectedItem) End Sub End Class