disusun oleh :
Team Komputasi DTM SV UGM
a=Convert::ToDouble(textBox1->Text);
b=Convert::ToDouble(textBox2->Text);
c=a+b;
label5->Text = Convert::ToString(c);
textBox3->Text = Convert::ToString(c);
}
comboBox
if (comboBox1->SelectedIndex == 0) c=a+b;
if (comboBox1->SelectedIndex == 1) c=a-b;
listBox
if (listBox1->SelectedIndex == 0) c=a+b;
if (listBox1->SelectedIndex == 1) c=a-b;
radioButton
if (radioButton1->Checked) c=a+b;
if (radioButton2->Checked) c=a-b;
checkBox
if (checkBox1->Checked)
if (checkBox1->Checked)
Reset Program
textBox1->Text="";
label5->Text="";
comboBox1->SelectedIndex=-1;
listBox1->SelectedIndex=-1;
radioButton1->Checked=false;
double a,b,c;
a=Convert::ToDouble(textBox1->Text);
if (a>0)
label4->Text = "Positif";
if (a<0)
label4->Text = "Negatif";
if (a==0)
MessageBox::Show("Input tdk boleh nol !!");
}
}
6 | Modul Visual Studio C++ 2010 DTM SV UGM
6. Menggunakan GridView
naw=Convert::ToDouble(textBox1->Text);
nak=Convert::ToDouble(textBox2->Text);
nak=Convert::ToDouble(textBox3->Text);
n=(nak-naw)/stp;
dataGridView1->RowCount=n+1;
for(i=1;i<=n;i++)
{
no=i+1
x=naw+(i*stp);
dx=2*x;
tgx=3*x;
dataGridView1->Rows[i]->Cells[0]->Value=no;
dataGridView1->Rows[i]->Cells[1]->Value=x;
dataGridView1->Rows[i]->Cells[2]->Value=dx;
dataGridView1->Rows[i]->Cells[3]->Value=tgx;
}
dataGridView1->RowCount=1;
dataGridView1->Rows[0]->Cells[0]->Value="";
dataGridView1->Rows[0]->Cells[1]->Value="";
dataGridView1->Rows[0]->Cells[2]->Value="";
dataGridView1->Rows[0]->Cells[3]->Value="";
dataGridView1->Rows[0]->Cells[4]->Value="";