i am using the following code
Code:
Private Sub AddAdmin(ByRef OneAdmin As AdminType)
Dim NumbersOfRecords, DeletedRecordNumber As Short
Dim Sender As System.Object
Dim e As System.EventArgs
'DeletedRecordNumber = FindDeletedCustomer()
FileOpen(1, AdminFile, OpenMode.Random, , , Len(OneAdmin))
If DeletedRecordNumber <> 0 Then
FilePut(1, OneAdmin, DeletedRecordNumber)
Else
NumbersOfRecords = LOF(1) / Len(OneAdmin)
FilePut(1, OneAdmin, NumbersOfRecords + 1)
End If
FileClose(1)
End Sub
this is adding admins function
i will shorten it by showing only the admin id section even tho there are other data which is collected
Code:
Private Sub Btn_AddNewAdmin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_AddNewAdmin.Click
Dim OneAdmin As AdminType
Dim AdminID As String
Dim AdminDeleted As Boolean
Dim Duplicate As Boolean
Dim Responce As Short
AdminFile = "Admin.dat"
If Btn_AddNewAdmin.Text = "Add Admin" Then
If Tbx_AdminID.Text.Length = 10 Then
AdminID = Tbx_AdminID.Text
Duplicate = ChkDpAdmin(AdminID)
If Not Duplicate Then
If (Tbx_AdminID.Text <> "")
OneAdmin.AdminID = Tbx_AdminID.Text
ive tried using streamreader and it just doesnt produce the padding i want with the sections split