control the position of components depending on others

vbnetrookie

Member
Joined
May 30, 2005
Messages
5
Programming Experience
Beginner
Hello all,


I was wondering if it's possible to place components on a form
depending on the size of another component.
Let's say I have a datagrid that gets populated from a database.
Depending on the choices of the user, that qill create a query, and
depending on that query, the datagrid might have 10 rows or it might
only have 1. I want to place a radiobuttonlist as well as a label just
beneath the datagrid, but in the design view, I place it right under
the datagrid. And when the datagrid has many rows, my label gets mixed
in the datagrid. Or if it has only one row, the label is way underneath
it....at the bottom.
How can I control the position of components depending on others that
get populated at runtime ?????
I know one of u guys knows this......has to!!
thanks in advance!!
JMT
 
you can re-position any object on the form except menu and statusbar

to re-position an object simply change the .Top and/or .Left values

to get the right hand edge of an object use .Left + .Width

and to get the bottom edge use .Top + .Height
 
A note to those who haven't used .NET 2.0 yet. The new framework contains layout classes that make this type of work much easier. They share some similarites with an HTML table.
 
Should this work with web forms as well?? cause it gives me errors such as :

c:\inetpub\wwwroot\Demo1\Default2.aspx.vb(274): 'Top' is not a member of 'System.Web.UI.WebControls.DataGrid'.
c:\inetpub\wwwroot\Demo1\Default2.aspx.vb(275): 'Left' is not a member of 'System.Web.UI.WebControls.DataGrid'.
c:\inetpub\wwwroot\Demo1\Default2.aspx.vb(276): Value of type 'Integer' cannot be converted to 'System.Web.UI.WebControls.Unit'.


Thanks for the replies!!
JMT
 
This is a Windows Forms forum. The WebForms DataGrid, while sharing similarities with the WinForms version, is a completely different object. You can get a list of an object's properties, WinForms or WebForms, in the help files. Just lookup the help topic for "<Object name> Members". If you want WebForms info you should probably post in one of the ASP.NET forums.
 
Back
Top