Question: I need help finishing this code. I need help recoding the Modify button (button 7) to work and do not know how to code the
I need help finishing this code. I need help recoding the Modify button (button 7) to work and do not know how to code the Delete button (button 8). Thank you!

Public Class Form1
Private xid() Private xname() Private xday() Private xdate() Private xrate() As Long Private tempID, tempname, tempday, temprate As String Private I, J, K, Record As Long Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click If currec + 1 = total Then Call xdisplay(0) currec = 0 Else Call xdisplay(currec + 1) currec = currec + 1 End If
End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click Me.Close() End Sub Private Sub xdisable() Button1.Enabled = False Button2.Enabled = False Button3.Enabled = False Button4.Enabled = False Button5.Enabled = False Button6.Enabled = False Button7.Enabled = False Button8.Enabled = False Button9.Enabled = False End Sub Private Sub xenable() Button1.Enabled = True Button2.Enabled = True Button3.Enabled = True Button4.Enabled = True Button5.Enabled = True Button7.Enabled = True Button8.Enabled = True Button9.Enabled = True End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click FileClose(1) Dim idtemp As Long Dim nametemp As String Dim daytemp As String Dim ratetemp As Decimal FileOpen(1, "Database.csv", OpenMode.Input)
If Button6.Text = "Add" Then TextBox1.Text = Format(xid(total - 1) + 1, "0") TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" Call xdisable() Button6.Enabled = True Button6.Text = "Save" Else idtemp = TextBox1.Text nametemp = TextBox2.Text daytemp = TextBox3.Text ratetemp = CDec(TextBox4.Text) WriteLine(1, idtemp, nametemp, daytemp, ratetemp) FileClose(1) Call Form1_Load(sender, e) Call xenable() Button6.Enabled = True Button6.Text = "Save" FileClose(1) End If End Sub Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click Dim id, temp As Long Dim ids As String temp = 0 ids = InputBox("Enter ID of desired Employee") If IsNumeric(ids) Then id = CLng(ids) For temp = 0 To total - 1 If (xid(temp) = id) Then currec = temp xdisplay(currec) Exit Sub End If Next MsgBox("Can't find Employee ID") Else MsgBox("Enter a numeric value") End If End Sub Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
End Sub Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click If Button7.Text = "Modify" Then Call xdisable() Button7.Enabled = True Button7.Text = "Save" Else Call xenable() Button7.Text = "Modify" xid(currec) = TextBox1.Text xname(currec) = TextBox2.Text xdate(currec) = TextBox3.Text xrate(currec) = TextBox4.Text FileOpen(1, "Database.csv", OpenMode.Output) WriteLine(1, "xid", "xname", "xdate", "xrate") FileClose(1) For m = 0 To I - 1 WriteLine(1, xid, xname, xdate, xrate) Next FileClose(1) End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click If currec - 1 = -1 Then Call xdisplay(total - 1) currec = total - 1 Else Call xdisplay(currec - 1) currec = currec - 1 End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Call xdisplay(total - 1) currec = total - 1 End Sub Private total, currec As Long Private Sub xdisplay(ByVal A As Integer) TextBox1.Text = Format(xid(A), "0") TextBox2.Text = xname(A) TextBox3.Text = xday(A) TextBox4.Text = Format(xrate(A), "0")
End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 'TextBox1.Text = Format(xid(0), "0") 'TextBox2.Text = xname(0) 'TextBox3.Text = xday(0) 'TextBox4.Text = Format(xrate(0), "0") Call xdisplay(0) currec = 0 End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load FileOpen(1, "Database.csv", OpenMode.Input) I = -1
Do Until EOF(1) If I = -1 Then Input(1, tempID) Input(1, tempname) Input(1, tempday) Input(1, temprate) Else ReDim Preserve xname(0 To I) ReDim Preserve xday(0 To I) ReDim Preserve xid(0 To I) ReDim Preserve xrate(0 To I) Input(1, xid(I)) Input(1, xname(I)) Input(1, xday(I)) Input(1, xrate(I))
End If I = I + 1 Loop
total = I currec = I - 1 FileClose(1) Exit Sub
End Sub End Class
Form Employee ID Name Birthdate Pay Rate First Previos Modify Last Next Delete Exit Add Pelc find ID Form Employee ID Name Birthdate Pay Rate First Previos Modify Last Next Delete Exit Add Pelc find ID
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
