Skip to content

Instantly share code, notes, and snippets.

@nicoletirado
Created December 12, 2011 22:16
Show Gist options
  • Select an option

  • Save nicoletirado/1469389 to your computer and use it in GitHub Desktop.

Select an option

Save nicoletirado/1469389 to your computer and use it in GitHub Desktop.
Public Class formModify
Private Sub formModify_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtCustomerId.Enabled = False
txtName.Enabled = False
txtFLName.Enabled = False
txtSLName.Enabled = False
txtAddressLine1.Enabled = False
txtAddressLine2.Enabled = False
txtCity.Enabled = False
txtState.Enabled = False
txtZipCode.Enabled = False
txtCountry.Enabled = False
txtBirthDate.Enabled = False
txtSSN.Enabled = False
txtWorkPhone.Enabled = False
txtFaxPhone.Enabled = False
txtCellphone.Enabled = False
txtEmail.Enabled = False
txtCreditLine.Enabled = False
txtCompanyName.Enabled = False
txtPinNumber.Enabled = False
btnFindRecordtoModify.Enabled = True
btnModifyRecord.Enabled = False
End Sub
Private Sub btnReturntoMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReturntoMenu.Click
Me.Close()
End Sub
Private Sub btnFindRecordtoModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindRecordtoModify.Click
Dim RecordNumber As Long
If (IsNumeric(txtCustomerId.Text.Trim) And (txtCustomerId.Text.Length = 9) And (CInt(Math.Sqrt(txtCustomerId.Text)) > 0)) Then
RecordNumber = CInt(Math.Sqrt(txtCustomerId.Text.Trim))
Else
MessageBox.Show("El numero de identificacion de cliente es invalido.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Limpiar el campo
txtCustomerId.Clear()
txtCustomerId.Focus()
End If
Try
FileGet(1, formMain.CustomerId, RecordNumber)
If RecordNumber = CInt(Math.Sqrt(variable de estructura)) Then
txtName = formMain.empleado.name.Trim
txtFLName = formMain.empleado.firstlastname.Trim
'etc...
txtCustomerId.Enabled = True
txtName.Enabled = True
txtFLName.Enabled = True
txtSLName.Enabled = True
txtAddressLine1.Enabled = True
txtAddressLine2.Enabled = True
txtCity.Enabled = True
txtState.Enabled = True
txtZipCode.Enabled = True
txtCountry.Enabled = True
txtBirthDate.Enabled = True
txtSSN.Enabled = True
txtWorkPhone.Enabled = True
txtFaxPhone.Enabled = True
txtCellphone.Enabled = True
txtEmail.Enabled = True
txtCreditLine.Enabled = True
txtCompanyName.Enabled = True
txtPinNumber.Enabled = True
btnModifyRecord.Enabled = True
'etc...
End If
Catch ex As Exception
MessageBox.Show("El record no está en el archivo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
txtCustomerId.Clear()
txtName.Text = String.Empty
txtFLName.Text = String.Empty
txtSLName.Text = String.Empty
txtAddressLine1.Text = String.Empty
txtAddressLine2.Text = String.Empty
txtCity.Text = String.Empty
txtState.Text = String.Empty
txtZipCode.Text = String.Empty
txtCountry.Text = String.Empty
txtBirthDate.Text = String.Empty
txtSSN.Text = String.Empty
txtWorkPhone.Text = String.Empty
txtFaxPhone.Text = String.Empty
txtCellphone.Text = String.Empty
txtEmail.Text = String.Empty
txtCreditLine.Text = String.Empty
txtCompanyName.Text = String.Empty
txtPinNumber.Text = String.Empty
txtCustomerId.Focus()
End Try
End Sub
Private Sub btnModifyRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModifyRecord.Click
Dim RecordNumber As Long
If (IsNumeric(variable) And (variable length = 9) And (tecnica(variable) > 0)) Then
RecordNumber = CInt(Math.Sqrt(variable))
Else
MessageBox.Show("El numero de identificacion de cliente es invalido.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
' Limpiar el campo
variable.Clear()
variable.Focus()
End If
If (txtName.Text.Trim <> String.Empty) Then
formMain.empleado.nombre = txtName.Text.Trim
Else
MessageBox.Show("Por favor, llene el campo de Nombre", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
'etc...
formMain.empleado.ssn = txtSSN.Text.Trim
formMain.empleado.workphone = txtWorkPhone.Text.Trim
formMain.empleado.email = txtEmail.Text.Trim
Try
FilePut(1, formMain.empleado, RecordNumber)
MessageBox.Show("El record se ha modificado.", "Modificacion Exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information)
txtName.Clear()
'etc...
txtName.Enabled = True
txtFirstLastName.Enabled = True
Catch ex As Exception
MessageBox.Show("Error al modificar el record", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment