Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to make a DataGrid work the same,when a user clicks or presses keys

How to make a DataGrid work the same,when a user clicks or presses keys

Scheduled Pinned Locked Moved Visual Basic
databasehelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fiaolle
    wrote on last edited by
    #1

    Hi I have a DataGrid with comboboxes (inherited from DataGridTextBoxColumn) and I'm woundering what methods or something runs when a user clicks in the DataGrid or ComboBox. In the comboboxes I use the KeyUp event for the user to choose an item in the combobox. When I choose an item with keys nothing happens, but when I click and choose an item in my combobox a new row appear in the DataGrid and that is what I want to happen. Is there someway I can get the same thing to happen whether I click or press keys in the combobox. Here is the code for using the keys to choose an item in the comboboxes Private Shadows Sub IntelliCmb_KeyUp(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles ColumnComboBox.KeyUp Dim index As Integer Dim actual As String Dim found As String If ((e.KeyCode = Keys.Back) Or _ (e.KeyCode = Keys.Left) Or _ (e.KeyCode = Keys.Right) Or _ (e.KeyCode = Keys.Up) Or _ (e.KeyCode = Keys.Down) Or _ (e.KeyCode = Keys.PageUp) Or _ (e.KeyCode = Keys.PageDown) Or _ (e.KeyCode = Keys.Home) Or _ (e.KeyCode = Keys.ShiftKey) Or _ (e.KeyCode = Keys.Tab) Or _ (e.KeyCode = Keys.F2) Or _ (e.KeyCode = Keys.End)) Then Return End If If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Delete Then If ColumnComboBox.Text = "" Then mblnEditing = True End If Return End If actual = ColumnComboBox.Text index = ColumnComboBox.FindString(actual) If (index > -1) Then ColumnComboBox.SelectedIndex = index ColumnComboBox.SelectionStart = actual.Length ColumnComboBox.SelectionLength = found.Length If ColumnComboBox.SelectedIndex <> 0 Then mblnEditing = True End If End If Please, I need help!!!! Fia

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups