473,406 Members | 2,867 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,406 software developers and data experts.

How to move with components that i create.

I have this code:
Expand|Select|Wrap|Line Numbers
  1. public partial class Form1 : Form
  2.     {
  3.         private Button cudlik;
  4.         int i;
  5. public Form1()
  6.   {
  7.     InitializeComponent();
  8.   }
  9.  
  10. public void button1_Click(object sender, EventArgs e)
  11. {
  12.   i++;
  13.   cudlik = new Button();
  14.   cudlik.Location = new System.Drawing.Point(150, 150 + 20 * i);
  15.   cudlik.Size = new System.Drawing.Size(120, 20);
  16.   cudlik.Name += "cudlik" + i;
  17.   cudlik.Text += i;
  18.   this.Controls.Add(cudlik);
  19.   timer1.Enabled = true;
  20.         }
  21.  
  22. private void timer1_Tick(object sender, EventArgs e)
  23.  {
  24.    cudlik.Left += 1;
  25.  }
  26.  
If I create the button in this way, it's moving just the last one that I create.

I want to move with every created buttons, but I don't know how to do it.
Apr 22 '11 #1
2 1615
hype261
207 100+
What you want to do is create a container of Controls. When you create a new control you need to add it to the Forms controls, but you also need to add it to the container. In your tick event you just cycle through all the controls in the container and individually move them left.
Apr 22 '11 #2
Could you please show me part of code with what you mean?
---------------------------------------------------------

I figured it out! Thanks.
Apr 23 '11 #3

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

Similar topics

0
by: alt | last post by:
We would like to introduce a project LabDotNet.Com. http://www.labdotnet.com It is collection of .NET related components and tools. On this site you can read brief descriptions of the products,...
6
by: Mario T. Lanza | last post by:
Greetings, I don't know about you guys but on many occasions I've asked myself whether or not someone else has solved a particular programming issue -- whether or not they developed a clever...
3
by: CodeRazor | last post by:
Hi, I am trying to dynamically create linkbuttons. They need an event handler, so i can respond to the user's click. I try to add the eventhandler on the fly, but when i click on the link, the...
9
by: [Yosi] | last post by:
Can I make an Excel file without having Excel in my PC ? I want to create Excel files from my C# application , then open those files later in another PC who have Excel installed . As we can open...
8
by: tranky | last post by:
i hope you can help me! It's possible create a moveable panel in vb.net? Click with mouse over it and move it everywhere!?!? It's possible? thank u!
1
by: Philip Wagenaar | last post by:
How can I move a printjob from one printqueue to another. The printqueue's both have the same printerdriver.
5
by: Jerry | last post by:
In ASP (pre .NET) I referenced components by MyObj = Server.CreateObject("DllName.Classname") In .NET, I know that to reference the Sql namespace I use <%@ Import...
2
by: DotNetGuy | last post by:
I have developed a data access layer in my web site application by using web client software factory and put it in my business module as a service. The question is: Is it a good option to reuse...
6
by: greg.hart | last post by:
Hello all, Just wanted to get some clarification on something. I was setting out to create a login page for people to login and then be able to access certain aspects of the website. Instead...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.