ADO DOT NET Posted January 11, 2007 Posted January 11, 2007 OKButton.Location.X = 81 OKButton.Location.Y = 165 OKButton.Size.Height = 22 OKButton.Size.Width = 65 Why I get error while using those command? how can I assign the location and size of a control in runtime then? :confused: Quote
*Experts* Nerseus Posted January 11, 2007 *Experts* Posted January 11, 2007 You'll have to set the Location and Size properties themselves. Try this: OKButton.Location = New Point(81, 165) OKButton.Size = New Size(22, 65) -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Leaders snarfblam Posted January 12, 2007 Leaders Posted January 12, 2007 When updating the bounds of UI objects, it is best to do them all at once. It will reduce flicker and if a large number of updates are made, they will go much more quickly. Ideally, the code should read something like: OKButton.Bounds = [color="Blue"]New[/color] Rectangle(81, 165, 22, 65) If you just wanted to change the size, or just wanted to change the location, code like that posted by Nerseus would be best. If you just want to change one aspect of the bounds, just the X or Y or width or height, then you would use the Left, Top, Width, or Height properties (respectively). The reason that you can't use the OKButton.Location.X property is rather technical, but it should suffice to say that you although you can't modify part of the Location (or size) properties, you can assign a new Point or Size object to those properties. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.