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. Activating last textbox in DataGridView on form active

Activating last textbox in DataGridView on form active

Scheduled Pinned Locked Moved C#
csshelptutorialquestion
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.
  • A Offline
    A Offline
    AndrusM
    wrote on last edited by
    #1

    How to activate last textbox in DataGridView on re-activate ? I created testcase for it: 1. Run code. 2. Enter some data to grid 3. Click other form caption 4. Click original form caption 5. Enter some characters Observed: entered characters are ignored Expected: entered characters must appear in last cell before form activation How to fix ?

    using System.Windows.Forms;

    public class Test
    {
    static void Main()
    {
    Application.Run(new MainForm());
    }
    }

    class MainForm : Form
    {
    public MainForm()
    {
    WindowState = FormWindowState.Maximized;
    IsMdiContainer = true;
    Form frm = new Childform();
    frm.MdiParent = this;
    frm.Show();
    Form frm2 = new Childform();
    frm2.MdiParent = this;
    frm2.Show();
    frm2.Left = 2000;
    }
    }

    class Childform : Form
    {
    public Childform()
    {
    var grid = new DataGridView();
    grid.Columns.Add(new DataGridViewTextBoxColumn());
    grid.EditMode = DataGridViewEditMode.EditOnEnter;
    Controls.Add(grid);
    }
    }

    Andrus

    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