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. C#
  4. commands don't work???

commands don't work???

Scheduled Pinned Locked Moved C#
question
2 Posts 2 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.
  • M Offline
    M Offline
    melanieab
    wrote on last edited by
    #1

    Hi, My project has several tab pages. When tabCoS is clicked on (which contains a datatable/datagrid), if a row was previously selected, I like to select it again. private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e) { if (this.tabControl1.SelectedTab == tabCoS) { if (rowState == "unselect"){this.dg.Select(row);} } } This doesn't work. Although when I throw a messagebox in before this.dg.Select(row);, after I hit OK, it works fine and the row is selected. This type of thing has happened before (commands don't work unless I put a messagebox in and click ok). Any idea why??? :confused: Thanks! Mel

    M 1 Reply Last reply
    0
    • M melanieab

      Hi, My project has several tab pages. When tabCoS is clicked on (which contains a datatable/datagrid), if a row was previously selected, I like to select it again. private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e) { if (this.tabControl1.SelectedTab == tabCoS) { if (rowState == "unselect"){this.dg.Select(row);} } } This doesn't work. Although when I throw a messagebox in before this.dg.Select(row);, after I hit OK, it works fine and the row is selected. This type of thing has happened before (commands don't work unless I put a messagebox in and click ok). Any idea why??? :confused: Thanks! Mel

      M Offline
      M Offline
      Michael Potter
      wrote on last edited by
      #2

      Are you sure your datagrid shows selection when it doesn't have focus? It may be that the tab control maintains focus when you switch between tabs. The return from MessageBox may be handled in a different way (i.e. set focus to first tab stop). Try replacing {this.dg.Select(row);} With {this.dg.Select(row);this.dg.Focus();}

      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