Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Gridview VB.NET
Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
 
        Try
            If e.KeyCode = 13 Then
 
                Dim cm As New OleDbCommand
                Dim da1 As New OleDbDataAdapter
                Dim ds1 As New DataSet
                OleCon_DB.Close()
                OleCon_DB.Open()
 

                If DataGridView1.Rows(x).Cells(0).Value = "" Then
                    MsgBox("Enter the Item Code")
                    DataGridView1.Rows(x).Cells(0).Value.Focus()
                Else
                    da1 = New OleDbDataAdapter("select * from itemname where itemcode='" & DataGridView1.Rows(x).Cells(0).Value & "'", OleCon_DB)
                    da1.Fill(ds1)
 
                    If ds1.Tables(0).Rows.Count < 1 Then
                        MsgBox("Invalid Item code")
                        DataGridView1.Rows(x).Cells(0).Value.Focus()
                    Else
                        DataGridView1.Rows(x).Cells(1).Value = Trim(ds1.Tables(0).Rows(0)(1))
                        DataGridView1.Rows(x).Cells(3).Value = Trim(ds1.Tables(0).Rows(0)(2))
                        '  txttaxamt.Text = Trim(ds1.Tables(0).Rows(0)(3))
                        DataGridView1.Rows(x).Cells(2).Value.Focus()
                    End If
                End If
            End If
 
          
            If e.KeyCode = Keys.F1 Then
                Call custload()
 

            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
 
    End Sub
Posted 8-Jul-13 2:16am
muthu07316
Edited 8-Jul-13 3:06am
(no name)2.7K
v2
Comments
ThePhantomUpvoter at 8-Jul-13 8:11am
   
This is just a code dump. It is not any kind of a question or any description of a problem.
muthu07 at 12-Aug-13 5:50am
   
how to fix this problm im enter a item code in grid view text box that time that table values trim anthar gridview text boxes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 220
3 Praneet Nadkar 197
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 8 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100