|  |  | 
          
            | ผมทำในส่วนของการค้นหาสึหมึกพิมพ์ครับ แล้วทีนี้ผมใส่ข้อมูลไอดีหรือข้อมูลของสีลงไปแล้วเกิดเออเร่อว่า Object reference not set to an instance of an object ตรงบรรทัดที่ 5-30 ครับ จะต้องแก้ยังไงดีครับ 
 Code (VB.NET)
 
     Private Sub txtSearch_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtSearch.KeyDown
        If txtSearch.Text <> "" Then
            If (e.KeyCode = Keys.Enter) Then
                Dim sqlPrintColor As String = ""
                sqlPrintColor = "SELECT * FROM PrintColor"
                If cboSearch.SelectedIndex = 0 Then
                    sqlPrintColor &= " WHERE (PrintCLID='" & txtSearch.Text & "')"
                ElseIf cboSearch.SelectedIndex = 1 Then
                    sqlPrintColor &= " WHERE (ColorName LIKE '%" & txtSearch.Text & "%')"
                End If
                sqlPrintColor &= " ORDER BY PrintCLID"
                With Conn
                    If .State = ConnectionState.Open Then
                        .Close()
                        .ConnectionString = strConn
                        .Open()
                    End If
                End With
                If IsFind = True Then
                    ds.Tables("PrintColor").Clear()
                End If
                da.SelectCommand.CommandText = sqlPrintColor
                da.Fill(ds, "PrintColor")
                If ds.Tables("PrintColor").Rows.Count <> 0 Then
                    IsFind = True
                    ClearAllBinding()
                    txtPrintCLID.DataBindings.Add("Text", ds, "PrintColor.PrintCLID")
                    txtColorName.DataBindings.Add("Text", ds, "PrintColor.ColorName")
                    txtColorInShop.DataBindings.Add("Text", ds, "PrintColor.ColorInShop")
                    txtColorInDisclose.DataBindings.Add("Text", ds, "PrintColor.ColorInDisclose")
                    txtColorTotal.DataBindings.Add("Text", ds, "PrintColor.ColorTotal")
                    dt = ds.Tables("PrintColor")
                    ShowPosition()
                    cmdAdd.Enabled = False
                    cmdEdit.Enabled = True
                    cmdMoveFirst.Enabled = True
                    cmdMovePrevious.Enabled = True
                    cmdMoveNext.Enabled = True
                    cmdMoveLast.Enabled = True
                    cmdEdit.Focus()
                Else
                    IsFind = False
                    MessageBox.Show("อุปกรณ์ที่คุณระบุ ไม่มี !!!", "ผลการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
                    ClearData()
                    lblShowPositions.Text = ""
                    cmdAdd.Enabled = True
                    cmdEdit.Enabled = False
                    cmdMoveFirst.Enabled = False
                    cmdMovePrevious.Enabled = False
                    cmdMoveNext.Enabled = False
                    cmdMoveLast.Enabled = False
                    txtSearch.Focus()
                    txtSearch.SelectAll()
                    Exit Sub
                End If
            End If
        End If
    End Sub
 
 
 Tag : .NET, Ms Access, VBScript, Win (Windows App), VB.NET
 
 
 |  
            | 
 ประวัติการแก้ไข
 2017-10-19 10:59:51
 2017-10-19 11:58:29
 |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2017-10-19 10:59:20 | By :
                          ford24832 | View :
                          1494 | Reply :
                          2 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |