I have a child panel in a form that contains some text fields and buttons. I tried setting the tabstop and tabindex properties for these controls so that the user can move from one control to another. But for some reason, the tab stops working, the cursor remains in the same field that has focus when I press the tab key. I am using C # with .Net 3.5 framework. Below is what my code looks like -
rightPanel.Controls.Clear();
marketMessageLabel = new Label();
marketMessageLabel.Location = new Point(0, 20);
marketMessageLabel.AutoSize = false;
marketMessageLabel.Size = new Size(rightPanel.Width, 42);
marketMessageLabel.BackColor = Color.White;
marketMessageLabel.Font = new System.Drawing.Font("Verdana", 8.00F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
rightPanel.Controls.Add(marketMessageLabel);
signinUserNameLabel = new Label();
signinUserNameLabel.Location = new Point(0, 150);
signinUserNameLabel.Size = new Size(60, 14);
signinUserNameLabel.BackColor = Color.White;
signinUserNameLabel.Text = "User Name";
signinUserNameLabel.Font = new System.Drawing.Font("Verdana", 9.00F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
rightPanel.Controls.Add(signinUserNameLabel);
signinUserNameTextBox = new TextBox();
signinUserNameTextBox.Location = new Point(0, 170);
signinUserNameTextBox.Width = this.Width - 80;
signinUserNameTextBox.Font = new System.Drawing.Font("Verdana", 9.00F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
signinUserNameTextBox.TabIndex = 0;
signinUserNameTextBox.TabStop = true;
rightPanel.Controls.Add(signinUserNameTextBox);
signinPasswordLabel = new Label();
signinPasswordLabel.Location = new Point(0, 192);
signinPasswordLabel.Size = new Size(100, 14);
signinPasswordLabel.Font = new System.Drawing.Font("Verdana", 9.00F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
signinPasswordLabel.BackColor = Color.White;
signinPasswordLabel.Text = "Password";
rightPanel.Controls.Add(signinPasswordLabel);
signinPasswordTextBox = new TextBox();
signinPasswordTextBox.Location = new Point(0, 210);
signinPasswordTextBox.Width = this.Width - 80;
signinPasswordTextBox.PasswordChar = '*';
signinPasswordTextBox.TabIndex = 1;
signinPasswordTextBox.TabStop = true;
rightPanel.Controls.Add(signinPasswordTextBox);
signInButton = new Button();
signInButton.Text = "Sign In";
signInButton.Font = new System.Drawing.Font("Verdana", 9.00F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
signInButton.Width = 70;
signInButton.BackColor = Color.White;
signInButton.Location = new Point(0,240);
signInButton.Click += new EventHandler(signInButton_Click);
signInButton.TabIndex = 2;
signInButton.TabStop = true;
rightPanel.Controls.Add(signInButton);
source
share