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?
Asked
Active
Viewed 188 times
-1
-
why you need it? you can use textbox itself – Uthistran Selvaraj Apr 27 '16 at 06:40
-
The intended function of the button is to replace several buttons with several text boxes. The text boxes would have different functionality than the buttons they would replace, so there isn't exactly a one-to-one relationship between text boxes and buttons. – user3735278 Apr 27 '16 at 06:46
-
1I did not get you still. in which platform? – Uthistran Selvaraj Apr 27 '16 at 06:48
-
Which Button & TextBox? WinForms, WPF, WebForms? – H H Apr 27 '16 at 06:53
-
WebControls text box and button if that helps any; trying to make a aspx page. – user3735278 Apr 27 '16 at 07:19
2 Answers
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.

Klaudiusz bryjamus
- 326
- 3
- 12
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