473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Button location

Hello,

Expand|Select|Wrap|Line Numbers
  1.   Button[] btn = new Button[100];
  2.         Random rnd = new Random();
  3.         Point pt = new Point();
  4.         public Form1()
  5.         {
  6.             InitializeComponent();            
  7.             for (int i = 0; i < 100; i++)
  8.             {
  9.                 btn[i].Location = new Point(100+25*i, 100);
  10.                 btn[i].Height = 25;
  11.                 btn[i].Width = 25;
  12.  
  13.             }
  14.             this.Controls.AddRange(btn);
  15.  
  16.         }
I need a field of buttons. Actually, i tried a variety of things including array of points, changing 1 point's coordinates, but he still doesn't want to eat line 9. I need that line to work. Or, maybe, there is some other way?

Thanks in advance.
Jun 7 '12 #1
2 3495
PsychoCoder
465 Expert Mod 256MB
I would put this inside your for loop to start with

Expand|Select|Wrap|Line Numbers
  1. this.Controls.AddRange(btn);
Then change it to
Expand|Select|Wrap|Line Numbers
  1. this.Controls.Add(btn[i]);
Jun 7 '12 #2
Tried it before. Nothing changed.
Jun 7 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Skip Hollowell | last post by:
I am working on a menu bar for a site, and am using buttons in the bar (because the customer wants to use accessKeys for each selection, apparently it is too much work to click on them with a...
4
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
5
by: Wonder | last post by:
How can I create or use the msgobx to show a message without a default button. The user has explicity to click on the button, so the msgbox closes it. Thanks,
13
by: johnemmatty | last post by:
I am using an asp page in which i dynamically fill the ACTION property of the form. The problem is that whenever i try to redirect to a html page using the javascript:location, it is getting...
2
by: RobAMacAF | last post by:
I am making it that when they click the form it adds a button. Sometimes however if they click to close to another button then it makes them overlap. Is there any easy way to tell if the buttons over...
6
by: sspost | last post by:
how can i disable the back button for a browser? I have been reading a lot of forums but cant find any answer to it...other than opening up the page, in which i want to disable the browser in a...
14
by: helpme09 | last post by:
Hello I am new to java and doing simple programs such as information input forms, and i was wondering what the code would be to setLocation a button to move randomly through out the form.
1
by: =?Utf-8?B?UmljaA==?= | last post by:
I placed a button on a form menustrip for the purpose of causing the horizontal scrollbar of my form to appear so that I can access controls outside of the form's current view (the controls are...
0
by: noaco | last post by:
hi, i have this button collection i add in run time and then remove, but for some reason it is not removed. Private Sub Button_Click(ByVal sender As Object, ByVal e As _ ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.