Vous êtes sur la page 1sur 5

Creating Digital Stopwatch

A program that can measure how long will it takes when you are doing on
something.

CODES:
Form1
Public Class Form1 Button1.Enabled = True If Label1.Text = "24" Then
Label1.Text = "0" Label3.Text = "0"
Private Sub Button1_Click(sender Label2.Text = "0" Label2.Text = "0"
As Object, e As EventArgs) Handles Label3.Text = "0" Label1.Text = "0"
Button1.Click Me.Hide() End If
Timer1.Start() Form2.Show() If Label1.Text = "60" Then
Button2.Enabled = True End Sub Label3.Text = "0"
Button3.Enabled = True Private Sub Button4_Click(sender Label2.Text = "0"
Button1.Enabled = True As Object, e As EventArgs) Handles Label1.Text = "0"
End Sub Button4.Click End If
Application.Exit() End Sub
Private Sub Button2_Click(sender End Sub End Class
As Object, e As EventArgs) Handles Form 2
Button2.Click
Timer1.Stop() Private Sub Timer1_Tick(sender As Public Class Form2
Button2.Enabled = False Object, e As EventArgs) Handles
Button3.Enabled = False Timer1.Tick Private Sub Button5_Click(sender
Button1.Enabled = True Label3.Text = Label3.Text + 1 As Object, e As EventArgs) Handles
End Sub If Label3.Text = "60" Then Button5.Click
Label3.Text = "0" TextBox1.Clear()
Private Sub Button3_Click(sender Label2.Text = Label2.Text + End Sub
As Object, e As EventArgs) Handles 1
Button3.Click End If Private Sub Button1_Click(sender
Form2.TextBox1.Text = As Object, e As EventArgs) Handles
Label1.Text + Label5.Text + If Label2.Text = "60" Then Button1.Click
Label2.Text + Label6.Text + Label2.Text = "0" Me.Hide()
Label3.Text Label1.Text = Label1.Text + Form1.Show()
Timer1.Stop() 1 End Sub
Button2.Enabled = False End If End Class
Button3.Enabled = False
Simple Animation Using Timer
A program that can show a simple animation just using a timer in visual basic.

Codes:

Form1
Public Class Form1

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick


PictureBox1.Location = New Point(PictureBox1.Location.X + 0, PictureBox1.Location.Y - 1)
If PictureBox1.Location.Y = 12 Then
Me.Hide()
Form2.Show()

End If
End Sub

Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click


Timer1.Start()
End Sub
End Class
Pythagoras Theorem using Vb.Net

A program that can calculate the specific measurement of the given right
angle triangle.

Codes:
Form1
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim a, b, c As Integer
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = Val(TextBox3.Text)

If b <> 0 And c <> 0 Then


TextBox1.Text = (b ^ 2 + c ^ 2) ^ (1 / 2)
If a <> 0 And c <> 0 Then
TextBox2.Text = (a ^ 2 + c ^ 2) ^ (1 / 2)
ElseIf a <> 0 And b <> 0 Then
TextBox3.Text = (a ^ 2 - b ^ 2) ^ (1 / 2)
End If
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
End Class
Simple Audio Player

A program that creates an audio player that can play a soundtrack using vb.net.

Codes:
Form1
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


OpenFileDialog1.ShowDialog()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
AxWindowsMediaPlayer1.Ctlcontrols.play()

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


AxWindowsMediaPlayer1.Ctlcontrols.play()

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


AxWindowsMediaPlayer1.Ctlcontrols.pause()

End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click


AxWindowsMediaPlayer1.Ctlcontrols.stop()
End Sub
Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
AxWindowsMediaPlayer1.settings.volume = TrackBar1.Value
End Sub
End Class
Photo Viewer

A program where you can view any pictures showing the location of it using vb.net.

Codes:
Form1
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


OpenFileDialog1.ShowDialog()
End Sub

Private Sub Form1_Activated(sender As Object, e As EventArgs) Handles Me.Activated


Me.OpenFileDialog1.Filter = "JPEG files (*.jpg)|*.jpg|PNG files(*.png)|*.png|ICO files
(*.ico)|*.ico|All files (*.*)|*.*"
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


End Sub

Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs)


Handles OpenFileDialog1.FileOk
Me.Text = OpenFileDialog1.FileName
Label1.Text = OpenFileDialog1.FileName
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
End Sub
End Class

Vous aimerez peut-être aussi