Minggu, 01 Juli 2012

MEMBUAT PROGRAM PENJADWALAN CPU SJF (SHORTEST JOB FIRST) DI VIISUAL BASIC NET

Ni Temen2 Ayo copas2 Mumpung gratis,   Cara Membuat PROGRAM PENJADWALAN CPU DENGAN VB NET.


Public Class Form1
Inherits System.Windows.Forms.Form


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim input(5) As Integer

''''THIS IS MORE LIKE AN ARRAY''''

input(0) = Val(TextBox7.Text)
input(1) = Val(TextBox8.Text)
input(2) = Val(TextBox9.Text)
input(3) = Val(TextBox10.Text)
input(4) = Val(TextBox11.Text)
input(5) = Val(TextBox12.Text)

Array.Sort(input)

TextBox1.Text = input(0)
TextBox2.Text = input(1)
TextBox3.Text = input(2)
TextBox4.Text = input(3)
TextBox5.Text = input(4)
TextBox6.Text = input(5)

Timer1.Enabled = True

End Sub

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

If ProgressBar1.Value < Val(TextBox1.Text) Then
ProgressBar1.Value = ProgressBar1.Value + 1

If ProgressBar1.Value = Val(TextBox1.Text) Then
Label12.Text = TextBox1.Text
Timer1.Enabled = False
Timer1.Stop()
Timer1.Dispose()
Timer2.Enabled = True

End If
End If

End Sub



Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick


If ProgressBar2.Value < Val(TextBox2.Text) Then
ProgressBar2.Value = ProgressBar2.Value + 1

If ProgressBar2.Value = Val(TextBox2.Text) Then
Label14.Text = Val(Label12.Text) + Val(TextBox2.Text)
Timer2.Enabled = False
Timer2.Stop()

Timer2.Dispose()
Timer3.Enabled = True



End If
End If

End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick



If ProgressBar3.Value < Val(TextBox3.Text) Then
ProgressBar3.Value = ProgressBar3.Value + 1

If ProgressBar3.Value = Val(TextBox3.Text) Then
Label15.Text = Val(Label14.Text) + Val(TextBox3.Text)
Timer3.Enabled = False
Timer3.Stop()
Timer3.Dispose()
Timer4.Enabled = True


End If
End If

End Sub

Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick



If ProgressBar4.Value < Val(TextBox4.Text) Then
ProgressBar4.Value = ProgressBar4.Value + 1
Label16.Text = Val(Label15.Text) + Val(TextBox4.Text)
If ProgressBar4.Value = Val(TextBox4.Text) Then
Timer4.Enabled = False
Timer4.Stop()
Timer4.Dispose()
Timer5.Enabled = True

End If
End If

End Sub

Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick


If ProgressBar5.Value < Val(TextBox5.Text) Then
ProgressBar5.Value = ProgressBar5.Value + 1

If ProgressBar5.Value = Val(TextBox5.Text) Then
Label17.Text = Val(Label16.Text) + Val(TextBox5.Text)
Timer5.Enabled = False
Timer5.Stop()
Timer5.Dispose()

Timer6.Enabled = True




End If
End If

End Sub

Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick



If ProgressBar6.Value < Val(TextBox6.Text) Then
ProgressBar6.Value = ProgressBar6.Value + 1

If ProgressBar6.Value = Val(TextBox6.Text) Then
Label18.Text = Val(TextBox6.Text) + Val(Label17.Text)
Timer6.Enabled = False
Timer6.Stop()
Timer6.Dispose()
Label10.Text = Val(Label12.Text) + Val(Label14.Text) + Val(Label15.Text) + Val(Label16.Text) + Val(Label17.Text) + Val(Label18.Text)
Label25.Text = Val(Label10.Text) / 6
End If
End If

End Sub


''''''''''''''WHAT YOU SEE BELOW IS JUST AN OPTION, MORE LIKE EXTRAS''''''''''''
'''''''''''''BUTTON3 IS USED HERE TO CLEAR THE FIELDS'''''''''''''''''
'''''''''''''BUTTON2 IS USED TO EXIT THE APPLICATION'''''''''''''

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

Dim button As DialogResult

button = MessageBox.Show _
("Are you sure you want to clear the fields?", _
"Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)

If button = Windows.Forms.DialogResult.Yes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
ProgressBar1.Value = 0
ProgressBar2.Value = 0
ProgressBar3.Value = 0
ProgressBar4.Value = 0
ProgressBar5.Value = 0
ProgressBar6.Value = 0

Label12.Text = ""
Label14.Text = ""
Label15.Text = ""
Label16.Text = ""
Label17.Text = ""
Label18.Text = ""
Label25.Text = ""
Label10.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
Else
'Do Nothing
End If
End Sub
End Class

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim button As DialogResult

button = MessageBox.Show _
("Are you sure you want to exit this application?", _
"Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)

If button = Windows.Forms.DialogResult.Yes Then
Application.Exit()
Else
'Do Nothing
End If
End Sub

1 komentar:

Maaf kk kalo bisa screenshot form nya dong
Thanks

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More