Rabu, 29 Januari 2014

Paket Program - Menghapus Data



Option Explicit
Dim bar
Dim newbar
Dim Totalbar  As Integer
Dim tmpnama() As String
Dim tmpalamat() As String
Dim tmpkelas() As String
Dim tmplahir() As String

Private Sub Command6_Click()
newbar = 1
Open "d:\datasiswa.txt" For Output As #1
Do While newbar < Totalbar
   If newbar >= bar Then
  
   tmpnama(newbar) = tmpnama(newbar + 1): tmpkelas(newbar) = tmpkelas(newbar + 1)
   tmpalamat(newbar) = tmpalamat(newbar + 1): tmplahir(newbar) = tmplahir(newbar + 1)
   End If
  
   Write #1, tmpnama(newbar), tmpkelas(newbar), tmpalamat(newbar), tmplahir(newbar)

   newbar = newbar + 1
Loop
  Totalbar = Totalbar - 1
  Close #1
       Text1.Text = " ": Text2.Text = " ": Text3.Text = " ": Text4.Text = " "

 End Sub

Private Sub Form_Load()
Me.Top = FormUtama.Top
Me.Left = FormUtama.Width + FormUtama.Left + 10
Totalbar = 30
ReDim tmpnama(Totalbar + 1)
ReDim tmpalamat(Totalbar + 1)
ReDim tmpkelas(Totalbar + 1)
ReDim tmplahir(Totalbar + 1)

bar = 1
Open "datasiswa.txt" For Input As #1
Do While Not EOF(1)
  
   Input #1, tmpnama(bar), tmpkelas(bar), tmpalamat(bar), tmplahir(bar)
   bar = bar + 1
  
Loop
    Totalbar = bar - 1
Close #1
LihatRec (Totalbar)
End Sub
 Sub LihatRec(bar As Integer)

Text1.Text = tmpnama(bar)
Text2.Text = tmpkelas(bar)
Text3.Text = tmpalamat(bar)
Text4.Text = tmplahir(bar)

End Sub
Private Sub CommandSebelum_Click(Index As Integer)
bar = bar - 1

If bar <= 1 Then bar = 1

LihatRec (bar)

End Sub

Private Sub CommandSelanjutnya_Click(Index As Integer)
bar = bar + 1

If bar >= Totalbar Then bar = Totalbar

LihatRec (bar)

End Sub

Rabu, 22 Januari 2014

Paket Program - Perbaikan Data




Option Explicit
Dim bar
Dim Totalbar  As Integer
Dim tmpnama() As String
Dim tmpalamat() As String
Dim tmpkelas() As String
Dim tmplahir() As String

Private Sub Command6_Click()
tmpnama(bar) = Text1.Text
tmpkelas(bar) = Text2.Text
tmpalamat(bar) = Text3.Text
tmplahir(bar) = Text4.Text
Dim newbar As Integer
newbar = 1
Open "d:\datasiswa.txt" For Output As #1
Do While newbar <= Totalbar
  
   Write #1, tmpnama(newbar), tmpkelas(newbar), tmpalamat(newbar), tmplahir(newbar)
   newbar = newbar + 1

Loop
Close #1
LihatRec (bar)

End Sub

Private Sub Form_Load() ' perbaikan data
Me.Top = FormUtama.Top
Me.Left = FormUtama.Width + FormUtama.Left + 10
Totalbar = 30
ReDim tmpnama(Totalbar + 1)
ReDim tmpalamat(Totalbar + 1)
ReDim tmpkelas(Totalbar + 1)
ReDim tmplahir(Totalbar + 1)

bar = 1
Open "datasiswa.txt" For Input As #1

  Do While Not EOF(1)
   Input #1, tmpnama(bar), tmpkelas(bar), tmpalamat(bar), tmplahir(bar)
   bar = bar + 1
    Loop
Totalbar = bar - 1
Close #1
LihatRec (Totalbar)
End Sub

Sub LihatRec(bar As Integer)

Text1.Text = tmpnama(bar)
Text2.Text = tmpkelas(bar)
Text3.Text = tmpalamat(bar)
Text4.Text = tmplahir(bar)
Text5.Text = bar


End Sub

Private Sub CommandSebelum_Click(Index As Integer)

bar = bar - 1
If bar <= 1 Then bar = 1
LihatRec (bar)

End Sub

Private Sub CommandSelanjutnya_Click(Index As Integer)

bar = bar + 1
If bar >= Totalbar Then bar = Totalbar
LihatRec (bar)

End Sub

Private Sub Text5_Change()
LihatRec (Val(Text5.Text))
End Sub

Rabu, 15 Januari 2014

Paket Program - Masukan Data


 


Option Explicit
Private Sub Command5_Click()
  Dim nama As String
  Dim kelas As String
  Dim alamat As String
  Dim lahir As String

nama = Text1.Text
kelas = Text2.Text
alamat = Text3.Text
lahir = Text4.Text

    Open "datasiswa.txt" For Append As #1
    Write #1, nama, kelas, alamat, lahir
    Close #1
   
     Text1.Text = " ": Text2.Text = " ": Text3.Text = " ": Text4.Text = " "

End Sub

 
Design by Wordpress Theme Template Blog Free | Bloggerized by Free Blogger Templates | coupon codes