Buttons with the property turned on do not work properly

I am creating a windows application. I have two buttons. I wrote the following code snippet.

frmRb obj = new frmrb();
private void btnPd_Click(object sender, EventArgs e)
        {
           btnCancel.Enabled = true;
           obj.btnRtn.Enabled = true;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
            obj.BringToFront();
            obj.Focus();
        }

The above coding does not cause errors.

All instructions work correctly, but the following statement does not work correctly:

obj.btnRtn.Enabled = true;

not executed.

The frmrb forms are brought to the fore and focused, but btnRtn is not included, this statement is obj.btnRtn.Enabled = true; does not work.

By default, I set the btnRtn Enabled property to false. And note that the Modifier property of the btnRtn button is set to PUBLIC.

Now how do I change the encoding so that I can follow this instruction.

obj.btnRtn.Enabled = true;

Can anybody help me?

Thanks in advance!

+3
11

, , . "", ! .

+3

, obj ( frmRb). . , frmRb .

obj.Show() ;

obj.BringToFront();

, frmRb. . , u

frmRb obj = new frmrb();

frmrb. u , obj.Show(); ur ::

frmRb obj = new frmrb();
private void btnPd_Click(object sender, EventArgs e)
        {
           btnCancel.Enabled = true;
           obj.btnRtn.Enabled = true;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
            obj.Show();
            obj.BringToFront();
            obj.Focus();                
        }

, u .

+2

, , , .

btnPd_Click? .

- , .

EDIT: , :

  • , . , .
  • , , phoenix. , .
  • , - - ? ?
+1

VB, #, . VB "handle SomeButton.Click", Click.

Google, # , Designer.cs, , , click, .

, (F9) , , - . , , , , , .

:

http://www.tek-tips.com/viewthread.cfm?qid=1442702&page=5

+1

. , .

+1

: private void btnPd_Click ( , EventArgs e)       {obj.btnRtn.Enabled = true;          btnCancel.Enabled = true; }

,

+1

... # , frmRb frmrb. , , 2 3 , .

private void InitializeComponent()
{
    this.btnPd = new System.Windows.Forms.Button();
    this.btnPd.Location = new System.Drawing.Point(90, 116);
    this.btnPd.Name = "btnPd";
    this.btnPd.Size = new System.Drawing.Size(75, 23);
    this.btnPd.TabIndex = 1;
    this.btnPd.Text = "button1";
    this.btnPd.UseVisualStyleBackColor = true;
    this.btnPd.Click += new System.EventHandler(this.btnPd_Click);
}
public System.Windows.Forms.Button btnRtn;

, btnPd? , ? , . , , , frmRb frmrb, .

+1

, , , , :

  • , enabled = true;
  • ;

frmRb obj = new frmrb(); obj.EnableButton

+1

. , "Locked" "true"

0

Pl btnRtn , btnRtn , pl

0

, - , , /, , .

I recently got a few CheckBoxes and NumericUpDowns not changing the enabled state, but that was just because they were in the GroupBox that had not been enabled. The moment of forehead hit for me, but it took me 20 minutes to understand why these controls do not respond!

0
source

Source: https://habr.com/ru/post/1711786/


All Articles