-1

I am trying to make a button that, upon clicking it, has its visibility turned off and has an invisible text box's visibility turned on. I would like the button and the text box to occupy the same area, but it would seem that, when trying to accomplish this is the Designer View of Visual Studio, the button shift away from the box every time I try to place said box over it. Is there any way for me to accomplish my intended goal? If so, what would I need to do to do so?

TGlatzer
  • 5,815
  • 2
  • 25
  • 46
user3735278
  • 261
  • 3
  • 13

2 Answers2

2

You have to use code to accomplish this:

void Form_Load(...) {
    InitializeComponent();
    this.textBox1.Location = this.button1.Locatioon;
    this.textBox1.Size = this.button1.Size;
    this.textBox1.Visible = false;
}

void button1_Click(...) {
    this.textBox1.Visible = true;
    this.button1.Visible = false;
}

Or something like this.

0

In property window you can copy location values from one control and paste it at the location of second control. Also need to make sure the size property is same.

lal
  • 166
  • 4