stuktur kendali
desinglah form berikut ini :
listing program
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace latihan1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int i;
for (i = 100; i > 0; i-=5)
{
comboBox1.Items.Add(i);
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
double NA = double.Parse(comboBox1.Text);
if (NA >= 80 && NA <= 100)
textBox1.Text = "A";
else if (NA >= 70 && NA <= 79)
textBox1.Text = "B";
else if (NA >= 60 && NA <= 69)
textBox1.Text = "C";
else if (NA >= 50 && NA <= 59)
textBox1.Text = "D";
else if (NA >= 0 && NA <= 49)
textBox1.Text = "E";
else
textBox1.Text = "";
if (textBox1.Text != "E")
textBox2.Text = "LULUS";
else if (textBox1.Text != "")
textBox2.Text = "GAGAL";
else
textBox2.Text = "";
}
}
}
0 comments:
Posting Komentar