Q16. Which of the following codes is correct for "Find CGPA" button to search for a CGPA of students?
Formt
id
Name
CGPA
1
James
2.45
2
Sara
3.45
Enter Name: Sara
3
Daniel
2.98
Find CGPA
Found, The CGPS is: 3.45
a. private void FindCGPA_Click(object sender, EventArgs e) {
int i;
for (i = 0; i < listView1.Size; i++)
if (listView1.Items[i].Text == textBox.Text) label.Text = "Found, The CGPS is: " + listView1.items[i].Text; }
b. private void FindCGPA_Click(object sender, EventArgs e) {
int i;
for (i = 0; i < listView1.items.Count; i++)
if (listView1.items[i].Subitems[1].Text == textBox.Text)
label.Text = "Found, The CGPS is: " + listView1.items[i].Subitems[2].Text; }
CMPE214 Final
c. private void FindCGPA_Click(object sender, EventArgs e) {
int i
while (i < listView1.Count) {
...
if (listView1.items[i] == textBox.Text)
label.Text = "Found, The CGPS is: " + listView1.Text;
d. private void FindCGPA_Click(object sender, EventArgs e) {
int i;
for (i = 0; i < listView1.length; i++)
if (listView1.items[i].Text == textBox.Text) label.Text = "Found, The CGPS is: " + listView1.items[i].Text;
iven the below.cum