none
Datagride Enter RRS feed

  • Soru

  • Datagridi  enter basınca bir alt  satıra keçiyor  ama  yapmak istediyim  entere basınca  alt satıra deyilde  hemen  yanındakı hücrelerde dolaşmak  her enter  dedikce saga doğru hücrelere kaysın

    tsk

    3 Ekim 2012 Çarşamba 17:27

Yanıtlar

  • http://www.vb-helper.com/howto_2005_datagridview_enter_key.html

     ' Save the current row number.
        Private m_EditingRow As Integer = -1
        Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
            m_EditingRow = DataGridView1.CurrentRow.Index
        End Sub
    
        ' If we just finished editing, restore the current row number.
        Private Sub DataGridView1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.SelectionChanged
            If m_EditingRow >= 0 Then
                Dim new_row As Integer = m_EditingRow
                m_EditingRow = -1
                DataGridView1.CurrentCell = _
                    DataGridView1.Rows(new_row). _
                        Cells(DataGridView1.CurrentCell.ColumnIndex)
            End If
        End Sub
    
        ' Ignore Return keys.
        Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
            If e.KeyCode = Keys.Return Then
                Dim cur_cell As DataGridViewCell = DataGridView1.CurrentCell
                Dim col As Integer = cur_cell.ColumnIndex
                col = (col + 1) Mod DataGridView1.Columns.Count
                cur_cell = DataGridView1.CurrentRow.Cells(col)
                DataGridView1.CurrentCell = cur_cell
    
                e.Handled = True
            End If
        End Sub

    • Yanıt Olarak İşaretleyen sahib745 3 Ekim 2012 Çarşamba 18:01
    3 Ekim 2012 Çarşamba 18:00
    Moderatör