BPA-

Hey,

I am making an application and i have two buttons. One on top of the other. When the top button is clicked i want the second button to move down about 100 pixels. What would be the code for the button to make this happen I have tried some i know and found some but none work.

Thanks



Re: Visual C# Express Edition How to make an object move?

Andrej Tozon

Hi,

see if the following code works for you:

Code Snippet

private void button1_Click(object sender, EventArgs e)

{

button2.Top += 100;

}

There may be other solutions for what you're trying to do. If you post some more info on your problem, we'll be able to provide more help.

Andrej






Re: Visual C# Express Edition How to make an object move?

sidhussim

Hi BPA have you tried the above code You could also use this code.

Code Snippet

private void button1_Click(object sender, EventArgs e)
{
button2.Location = System.Drawing.Point(button1.left,button1.top + 100);
}






Re: Visual C# Express Edition How to make an object move?

Anonymousaaaaaaaaaaaaaaaahhhh

button1 = button1.left + 1

this has to be in a timer!





Re: Visual C# Express Edition How to make an object move?

Anonymousaaaaaaaaaaaaaaaahhhh

button1.left = button1.left + 1

must be in timer!





Re: Visual C# Express Edition How to make an object move?

sidhussim





Re: Visual C# Express Edition How to make an object move?

sidhussim

Today, 7:25 AM UTC
Hi Anonymousaaaaaaaaaaaaaaaahhhh
Why does it have to be in a timer The poster did not say they wanted it to scroll down.