How can I make a scrollable list of textboxes?
-
In my Winforms program the user chooses a combobox value of 2-16 and I would like to generate a corresponding number of textboxes when they press a button, preferably in a scrollable list to keep the form a smaller manageable size. Is this possible? For those suggesting a flowlayout, how would I add textboxes based on the number chosen in my combobox?
-
Answer:
You can add the textboxes to a FlowLayountPanel. Make sure you set the AutoScroll property to true: private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { flowLayoutPanel1.Controls.Clear(); if (comboBox1.SelectedIndex == -1) return; int numberOfTextBoxes = int.Parse(comboBox1.SelectedItem.ToString()); for (int i = 0; i < numberOfTextBoxes; ++i) flowLayoutPanel1.Controls.Add(new TextBox()); }
Fuzz Evans at Stack Overflow Visit the source
Other answers
Add a FlowLaoyutPanel and when you click the button, add manually the textboxes to the FlowLayoutPanel
Juan Carlos Vega Neira
You can add your TextBoxes into a http://msdn.microsoft.com/en-gb/library/system.windows.forms.flowlayoutpanel.aspx and set its property AutoScroll to true.
cevik
Related Q & A:
- How can I make a myspace comment into a picture caption?Best solution by Yahoo! Answers
- How can I make a hole through a stone or crystal?Best solution by Yahoo! Answers
- How can I make a phone call to a cruise ship?Best solution by traveltips.usatoday.com
- How do I make a mail list?Best solution by Yahoo! Answers
- How can I make my friends list private on Facebook?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.