Program Perkalian Dengan Looping Pada Visual Studio 2008
gambar diatas adalah tampilan untuk program yang akan di buat , untuk propertiesnya silahkan di sesuaikan sendiri
Syntax :::
Imports System.IO
Public Class Form1
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i, a, n, kali As Integer
Dim hasil
a = TextBox2.Text
n = TextBox3.Text
kali = TextBox1.Text
hasil = ""
For i = a To n
hasil = hasil & kali & " x " & i & vbTab & " = " & kali * i & vbCrLf
Next
TextBox4.Text = hasil
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim outputfile As StreamWriter
Try
outputfile = New StreamWriter("D:\PerkalianLooping.txt", True)
Catch
MessageBox.Show("Error Writing File...")
End Try
Try
outputfile.WriteLine(Now())
outputfile.WriteLine(TextBox4.Text)
outputfile.WriteLine()
outputfile.WriteLine()
outputfile.Dispose()
MessageBox.Show("Data Sudah Disimpan . . .")
Catch
MessageBox.Show("Sorry! Error Writing File...")
End Try
End Sub
End Class
Tidak ada komentar:
Posting Komentar