473,387 Members | 1,766 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,387 software developers and data experts.

Control initialisation

I'm not sure what to make of this problem, but hopefully it's fixable. I have
created a 'Table' control which is basically just a grid of text boxes.
However, whenever the control is initialised it is done so in the wrong order:

this.table1.Columns = 3;
this.table1.DefaultColumnWidth = 96;
this.table1.DefaultRowHeight = 22;
this.table1.Rows = 3;

That is an extract from a form's InitializeComponent function. As should be
able to see the table columns are created before the default column width is
specified when it really should be done beforehand. Is there any way to force
the designer to initialise the properties of a control in a specific order as
opposed to alphabetic?

Thanks in advance
Nov 17 '05 #1
3 1193
Barguast,

AFAIK, there is no way to change this. Classes in general should not
force properties to be set in a specific order, it's just bad design. If
you require all of this information, then you should have a method that
takes everything at once, and performs the operation.

In this case, you will have to make your control adaptable so that it
can react to changes in any of the properties that affect the appearance of
the control. So, when the columns change, you add a new column.

You should probably change the property names to ColumnWidth and
RowHeight. This way, when they are changed, all of the items on the control
change (after all, that is the effect you want).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Barguast" <It*****************@Email.com> wrote in message
news:69**********************************@microsof t.com...
I'm not sure what to make of this problem, but hopefully it's fixable. I
have
created a 'Table' control which is basically just a grid of text boxes.
However, whenever the control is initialised it is done so in the wrong
order:

this.table1.Columns = 3;
this.table1.DefaultColumnWidth = 96;
this.table1.DefaultRowHeight = 22;
this.table1.Rows = 3;

That is an extract from a form's InitializeComponent function. As should
be
able to see the table columns are created before the default column width
is
specified when it really should be done beforehand. Is there any way to
force
the designer to initialise the properties of a control in a specific order
as
opposed to alphabetic?

Thanks in advance

Nov 17 '05 #2
In article <69**********************************@microsoft.co m>,
It*****************@Email.com says...
I'm not sure what to make of this problem, but hopefully it's fixable. I have
created a 'Table' control which is basically just a grid of text boxes.
However, whenever the control is initialised it is done so in the wrong order:

this.table1.Columns = 3;
this.table1.DefaultColumnWidth = 96;
this.table1.DefaultRowHeight = 22;
this.table1.Rows = 3;

That is an extract from a form's InitializeComponent function. As should be
able to see the table columns are created before the default column width is
specified when it really should be done beforehand. Is there any way to force
the designer to initialise the properties of a control in a specific order as
opposed to alphabetic?

Thanks in advance


Without seeing your code, I'm assuming you have some 'side effects' in
your property setters.

Look at the System.ComponentModel.ISupportInitialize documentation. It
will let you know when your control is starting to be initialized and
when it is done being initialized.

--
Larry Steeger
RusSte, Inc. - http://www.russte.com
Nov 17 '05 #3
I wasn't too sure about it myself either. I'd probably be best if I had an
array of column width / row heights values rather than a 'default' - that'd
also let you specify the size of each individual row / column rather than
restricting them all to be the same.

Thanks for the speedy response ;)

"Nicholas Paldino [.NET/C# MVP]" wrote:
Barguast,

AFAIK, there is no way to change this. Classes in general should not
force properties to be set in a specific order, it's just bad design. If
you require all of this information, then you should have a method that
takes everything at once, and performs the operation.

In this case, you will have to make your control adaptable so that it
can react to changes in any of the properties that affect the appearance of
the control. So, when the columns change, you add a new column.

You should probably change the property names to ColumnWidth and
RowHeight. This way, when they are changed, all of the items on the control
change (after all, that is the effect you want).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Barguast" <It*****************@Email.com> wrote in message
news:69**********************************@microsof t.com...
I'm not sure what to make of this problem, but hopefully it's fixable. I
have
created a 'Table' control which is basically just a grid of text boxes.
However, whenever the control is initialised it is done so in the wrong
order:

this.table1.Columns = 3;
this.table1.DefaultColumnWidth = 96;
this.table1.DefaultRowHeight = 22;
this.table1.Rows = 3;

That is an extract from a form's InitializeComponent function. As should
be
able to see the table columns are created before the default column width
is
specified when it really should be done beforehand. Is there any way to
force
the designer to initialise the properties of a control in a specific order
as
opposed to alphabetic?

Thanks in advance


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim | last post by:
Please advise if you can. Presumably initialisation of members in member initialisation lists is perfomed by 'C' run-time startup. If the CRT was never started-up would those members be garbage?...
2
by: John Carson | last post by:
One routinely hears that the order of initialisation of objects with static storage duration in different translation units cannot in general be guaranteed. I have a question about one way to...
6
by: clilley | last post by:
The following code causes a segmentation fault on DEC Tru64: foo.cc (built into libFoo.so) //--------------------------- include <iostream> bool createFoo() { std::cout << "createFoo" <<...
3
by: sushant | last post by:
hi all, whats the difference between assignement and initialisation in C. is assignement related with scanf() and initialisation with (int x=10;) sushant
4
by: theo | last post by:
Program flow...load file,then extract the xml text tags from the file,then the number of Xml tags retrieved from the file determines the number of dropdownlist controls instanciated in the...
8
by: Tim Clacy | last post by:
1) Is this initialising the reference 'u' to the address of the literal '2' or to the address 0x00000002? unsigned const& u = 2; 2) What is the different between the initialisation of 'u'...
13
by: Frederick Gotham | last post by:
I have just been reading 8.5 in the Standard, and am trying to make sense of the different kinds of initialisations. Up until now, I thought of an object as either NOT being initialised (i.e....
2
by: Xavier | last post by:
Hi, When I create a user control textbox (like "public class mytextbox : textbox") in C# and use it on another form, properties like font, colors, etc. are not inherited. Is this behavor normal...
4
by: Kevin Frey | last post by:
I have an assembly written in C++/CLI that also links in non-clr Native C++ (the C++/CLI wraps the Native C++ functionality). This assembly has an in-built tracing system that needs to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...

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.