Prikazi cijelu temu 08.03.2018 12:53
xl_kid Van mreze
Clan
Registrovan od:11.11.2008
Lokacija:-


Predmet:Enter kao tab u DataGridView kako?
Pomoć prijatelja Smiling
kako da u DataGridView-u nateram ENTER da radi kao TAB. Dole je kod sa forme

podešavanja
EditMode: EditOnEnter

cod
Public Class Form1

Private Sub PorudzbineBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles PorudzbineBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.PorudzbineBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Porudzbine_DataSet)
Me.PorudzbineDetaljiTableAdapter.Update(Me.Porudzbine_DataSet)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try

End Sub

Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Enter Then
Me.SelectNextControl(Me.ActiveControl, True, True, True, False) 'for Select Next Control
End If
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Porudzbine_DataSet.PorudzbineDetalji' table. You can move, or remove it, as needed.
Me.PorudzbineDetaljiTableAdapter.Fill(Me.Porudzbine_DataSet.PorudzbineDetalji)
'TODO: This line of code loads data into the 'Porudzbine_DataSet.Relacije' table. You can move, or remove it, as needed.
Me.RelacijeTableAdapter.Fill(Me.Porudzbine_DataSet.Relacije)
'TODO: This line of code loads data into the 'Porudzbine_DataSet.Kupci' table. You can move, or remove it, as needed.
Me.KupciTableAdapter.Fill(Me.Porudzbine_DataSet.Kupci)
'TODO: This line of code loads data into the 'Porudzbine_DataSet.Porudzbine' table. You can move, or remove it, as needed.
Me.PorudzbineTableAdapter.Fill(Me.Porudzbine_DataSet.Porudzbine)

End Sub

Private Sub NazivComboBox_LostFocus(sender As Object, e As EventArgs) Handles NazivComboBox.LostFocus
Dim id_dm As New Porudzbine_DataSetTableAdapters.KupciTableAdapter

Try
KupacIDTextBox.Text = id_dm.id_dm_ScalarQuery(NazivComboBox.Text)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub

Private Sub PorudzbineDetaljiDataGridView_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles PorudzbineDetaljiDataGridView.CellEndEdit

Dim naziv_proizvoda As New Porudzbine_DataSetTableAdapters.ProizvodiTableAdapter

If e.ColumnIndex = 0 Then

If Val(PorudzbineDetaljiDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex).Value) > 0 Then
PorudzbineDetaljiDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex + 1).Value = naziv_proizvoda.NazivProizvoda_ScalarQuery(CInt(Val(PorudzbineDeta
ljiDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex).Value)))

End If

End If

End Sub

End Class