Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

How to enable textbox1 in form2 using button in form1

$
0
0

goodday to all,

i created a two forms,

Form1 = mdiParent

Form2 = mdiChild

Form1 contains;

button1 = to show Form2

button2 = to enable textBox1 in Form2

Form2 contains

textBox1 (I set the property enabled to false, and modifier to public)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.Owner = this;
            f2.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.textBox1.Enabled = true;
        }
    }
}

when I click button2 nothing happens in textbox1

please help me, i am a total newbie.

thankyou in advance


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>