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. To focus or not to focus

To focus or not to focus

Scheduled Pinned Locked Moved C#
graphicshelpquestion
4 Posts 4 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.
  • B Offline
    B Offline
    barbiomalefico
    wrote on last edited by
    #1

    Hi, I have write a simple application only to understand the Select command, but it doesn't work well. In my application i have 3 button. When I click button 1 i disable button 1 and 2. When I click on button3 i reanable button 1 and 2 and want to select button 1 again. The code (without the designer part) i wrote is the following: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = true; button1.Select(); } } } What should i do to solve this problem? Best Regards Ciao Rudy Barbieri

    L S 2 Replies Last reply
    0
    • B barbiomalefico

      Hi, I have write a simple application only to understand the Select command, but it doesn't work well. In my application i have 3 button. When I click button 1 i disable button 1 and 2. When I click on button3 i reanable button 1 and 2 and want to select button 1 again. The code (without the designer part) i wrote is the following: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = true; button1.Select(); } } } What should i do to solve this problem? Best Regards Ciao Rudy Barbieri

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It works. I didn't see any problem. After clicking button3, the selection is back to button1.

      T 1 Reply Last reply
      0
      • B barbiomalefico

        Hi, I have write a simple application only to understand the Select command, but it doesn't work well. In my application i have 3 button. When I click button 1 i disable button 1 and 2. When I click on button3 i reanable button 1 and 2 and want to select button 1 again. The code (without the designer part) i wrote is the following: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; button2.Enabled = false; } private void button3_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = true; button1.Select(); } } } What should i do to solve this problem? Best Regards Ciao Rudy Barbieri

        S Offline
        S Offline
        Saqib Mehmood
        wrote on last edited by
        #3

        Use Focus instead of select button1.Focus()

        Saqib

        1 Reply Last reply
        0
        • L Lost User

          It works. I didn't see any problem. After clicking button3, the selection is back to button1.

          T Offline
          T Offline
          Tamimi Code
          wrote on last edited by
          #4

          try to put other buttons on the from, put you code not in the first buttons ...., it will not work

          When you get mad...THINK twice that the only advice Tamimi - Code

          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