Imports System Imports System.Data Imports System.Data.SqlClient Imports System.IO Imports System.Text Public Class PCBScanForm Private cnstr = mainForm.cnstr Private conn As New SqlConnection(cnstr) Private myQuery As String = String.Empty Private myCommand As SqlCommand Private adapter As SqlDataAdapter = New SqlDataAdapter() Private ds As New DataSet("Machines") Private i, limit As Integer Private oldMchCode As String = String.Empty Private addMode, editMode As Integer Private row As Integer Private Sub PPReceiveForm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated txtStart.Focus() End Sub Private Sub machineForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.MdiParent = mainForm Control.CheckForIllegalCrossThreadCalls = False Me.Top = 0 Me.Left = 0 dtNow.Value = DateTime.Now txtOperator.Text = loginForm.username Timer1.Enabled = True txtStart.Focus() End Sub Private Sub ts_close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.Close() End Sub Private Sub clear() txtSerialno.Text = String.Empty txtStart.Text = String.Empty End Sub Private Sub txtStart_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtStart.KeyUp If e.KeyCode = Keys.Enter Then Dim fChar As String = String.Empty Dim entry As String = txtStart.Text If txtStart.Text <> String.Empty Then Dim pcb As New PCB txtSerialno.Text = txtStart.Text pcb.serialno = txtSerialno.Text pcb.lastupdate = dtNow.Value pcb.lastupdatedby = txtOperator.Text pcb.add() clear() txtStart.Focus() End If End If End Sub End Class