Hayden Sim
Hayden Sim

Reputation: 33

Location by code. C#

I would like to change the Y location for a dataGridView to 75, I am trying to move it up at the click of a button.

have already tried

this.dataGridView1.Location = new Point(
 this.dataGridView1.Location.X,
 this.dataGridView1.Location.Y
);

Upvotes: 3

Views: 7059

Answers (3)

ErSelle_Pro22
ErSelle_Pro22

Reputation: 1

Just try this:

dataGridView1.Left = 58; //X coordinate
dataGridView1.Top  = 57; //Y coordinate

Upvotes: 0

Razor23 Donetsk
Razor23 Donetsk

Reputation: 506

More shortly this.dataGridView1.Top = 75;

Upvotes: 2

Mitch Wheat
Mitch Wheat

Reputation: 300559

Presumably you meant:

this.dataGridView1.Location = new Point(this.dataGridView1.Location.X, 75);

Upvotes: 5

Related Questions