If e.KeyCode = Keys.Enter Then
Dim check As Boolean = False
If TextBox2.Text = "" Then
TextBox2.Focus()
Else
sb.Remove(0, sb.Length)
sb.Append("select a.FG_NAME, b.u_price ")
sb.Append("from in_goods a join so_standard b on a.OU_COLDE=b.ou_code and a.FG_CODE=b.fg_code ")
sb.Append("where a.OU_COLDE='" + TextBox1.Text + "'and a.FG_CODE='" + TextBox2.Text + "'")
Dim seStr As String = sb.ToString()
Dim dr As SqlDataReader
With com
.CommandType = CommandType.Text
.CommandText = seStr
.Connection = con
dr = .ExecuteReader
If dr.HasRows Then
dt = New DataTable
dt.Load(dr)
TextBox3.Text = dt.Rows(0)("FG_NAME").ToString()
TextBox5.Text = dt.Rows(0)("u_price").ToString()
TextBox4.Focus()
Else
DialogResult = MessageBox.Show("ไม่พบข้อมูลในฐานข้อมูล คุณต้องการเพิ่มข้อมูลในฐานข้อมูลหรือไม่", "ข้อความแจ้งเตือน", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If DialogResult = Windows.Forms.DialogResult.Yes Then
Dim check_save As Boolean
Dim fmadd As New fmadd_product
fmadd.ShowDialog()
check_save = fmadd.check_save
If check_save = True Then
TextBox2.Text = fmadd_product.tb3.Text
TextBox3.Text = fmadd_product.tb4.Text
TextBox5.Text = fmadd_product.tb5.Text
TextBox4.Focus()
Else
TextBox2.Select()
TextBox2.Focus()
End If
Else
MessageBox.Show("ตรวจสอบบริษัท ก่อนว่าถูกต้องหรือไม่", "ตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
ComboBox1.Focus()
End If
End If
dr.Close()
End With
End If
End If