473,326 Members | 2,095 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,326 software developers and data experts.

resize

How can I resize a list ? thanks

Nov 18 '06 #1
7 1268
Hi Deniel,

If it's some sort of list Control to which you are referring then:

- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
properties

- for WebControl set the Width or Height properties or add custom attributes
and styles.

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
How can I resize a list ? thanks

Nov 18 '06 #2
class A {
public int a;
}
private void func()
{
List<Aaref=new List<A>();
//dosometing
aref.resize(10000); <------ This is what i want to do
}

But there is no resize() implemeted.
Thanks for any help

Dave Sexton wrote:
Hi Deniel,

If it's some sort of list Control to which you are referring then:

- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
properties

- for WebControl set the Width or Height properties or add custom attributes
and styles.

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
How can I resize a list ? thanks
Nov 18 '06 #3
Hi Deniel,

List<Twill expand on its own when you add items to the list. You can set
the Capacity, which affects how automatic resizing occurs within the List.

"List<TCapacity Property"
http://msdn2.microsoft.com/en-us/library/y52x03h2.aspx

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
class A {
public int a;
}
private void func()
{
List<Aaref=new List<A>();
//dosometing
aref.resize(10000); <------ This is what i want to do
}

But there is no resize() implemeted.
Thanks for any help

Dave Sexton wrote:
>Hi Deniel,

If it's some sort of list Control to which you are referring then:

- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
properties

- for WebControl set the Width or Height properties or add custom
attributes
and styles.

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@f16g2000cwb.googleg roups.com...
How can I resize a list ? thanks

Nov 18 '06 #4
Thanks Dave for your answer,
I still wonder how i can sort the list based on the comparison of "a"
values

I mean
private bool comp(A aref, A bref)
{
return aref.a<bref.a;
}
if i put this function in a icomparable, implementation may become
complex,
built-in sort of List can't do this, can it ? How can I make a sort()
then ?

Dave Sexton wrote:
Hi Deniel,

List<Twill expand on its own when you add items to the list. You can set
the Capacity, which affects how automatic resizing occurs within the List.

"List<TCapacity Property"
http://msdn2.microsoft.com/en-us/library/y52x03h2.aspx

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
class A {
public int a;
}
private void func()
{
List<Aaref=new List<A>();
//dosometing
aref.resize(10000); <------ This is what i want to do
}

But there is no resize() implemeted.
Thanks for any help

Dave Sexton wrote:
Hi Deniel,

If it's some sort of list Control to which you are referring then:

- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
properties

- for WebControl set the Width or Height properties or add custom
attributes
and styles.

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
How can I resize a list ? thanks
Nov 18 '06 #5
Thanks Dave for your help

Dave Sexton wrote:
Hi Deniel,

List<Twill expand on its own when you add items to the list. You can set
the Capacity, which affects how automatic resizing occurs within the List.

"List<TCapacity Property"
http://msdn2.microsoft.com/en-us/library/y52x03h2.aspx

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
class A {
public int a;
}
private void func()
{
List<Aaref=new List<A>();
//dosometing
aref.resize(10000); <------ This is what i want to do
}

But there is no resize() implemeted.
Thanks for any help

Dave Sexton wrote:
Hi Deniel,

If it's some sort of list Control to which you are referring then:

- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
properties

- for WebControl set the Width or Height properties or add custom
attributes
and styles.

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
How can I resize a list ? thanks
Nov 18 '06 #6
Hi Deniel,
here is an example of how you can sort the contents of your list using an
anonymous delegate, which makes it very simple to sort the items in the list:

class Person
{
private string name;

public Person(string name)
{
this.name = name;
}

public string Name
{
get
{
return this.name;
}
}
}
static void Main(string[] args)
{
List<Personpeople = new List<Person>();

Person mark = new Person("mark");
Person bob = new Person("bob");
Person frank = new Person("frank");

people.Add(mark);
people.Add(bob);
people.Add(frank);

people.Sort(delegate(Person p1, Person p2)
{
return p1.Name.CompareTo(p2.Name);
}
);

for (int i = 0; i < people.Count; ++i)
{
Console.Out.WriteLine(people[i].Name);
}

Console.ReadLine();
}

HTH
Mark.
--
http://www.markdawson.org
"Deniel Rose'" wrote:
Thanks Dave for your answer,
I still wonder how i can sort the list based on the comparison of "a"
values

I mean
private bool comp(A aref, A bref)
{
return aref.a<bref.a;
}
if i put this function in a icomparable, implementation may become
complex,
built-in sort of List can't do this, can it ? How can I make a sort()
then ?

Dave Sexton wrote:
Hi Deniel,

List<Twill expand on its own when you add items to the list. You can set
the Capacity, which affects how automatic resizing occurs within the List.

"List<TCapacity Property"
http://msdn2.microsoft.com/en-us/library/y52x03h2.aspx

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
class A {
public int a;
}
private void func()
{
List<Aaref=new List<A>();
//dosometing
aref.resize(10000); <------ This is what i want to do
}
>
But there is no resize() implemeted.
Thanks for any help
>
Dave Sexton wrote:
>Hi Deniel,
>>
>If it's some sort of list Control to which you are referring then:
>>
>- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
>properties
>>
>- for WebControl set the Width or Height properties or add custom
>attributes
>and styles.
>>
>--
>Dave Sexton
>>
>"Deniel Rose'" <de*************@yahoo.com.auwrote in message
>news:11**********************@f16g2000cwb.googleg roups.com...
How can I resize a list ? thanks
>
>

Nov 18 '06 #7
Hi Deniel,

Try the following code:

List<intlist = new List<int>();
list.Add(10);
list.Add(3);
list.Add(16);

list.Sort(
delegate(int i1, int i2) // anonymous method
{
return i1.CompareTo(i2);
});
--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Thanks Dave for your answer,
I still wonder how i can sort the list based on the comparison of "a"
values

I mean
private bool comp(A aref, A bref)
{
return aref.a<bref.a;
}
if i put this function in a icomparable, implementation may become
complex,
built-in sort of List can't do this, can it ? How can I make a sort()
then ?

Dave Sexton wrote:
>Hi Deniel,

List<Twill expand on its own when you add items to the list. You can set
the Capacity, which affects how automatic resizing occurs within the List.

"List<TCapacity Property"
http://msdn2.microsoft.com/en-us/library/y52x03h2.aspx

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11*********************@m73g2000cwd.googlegr oups.com...
class A {
public int a;
}
private void func()
{
List<Aaref=new List<A>();
//dosometing
aref.resize(10000); <------ This is what i want to do
}

But there is no resize() implemeted.
Thanks for any help

Dave Sexton wrote:
Hi Deniel,

If it's some sort of list Control to which you are referring then:

- for WinForms set any of the Bounds, ClientSize, Size, Width or Height
properties

- for WebControl set the Width or Height properties or add custom
attributes
and styles.

--
Dave Sexton

"Deniel Rose'" <de*************@yahoo.com.auwrote in message
news:11**********************@f16g2000cwb.googleg roups.com...
How can I resize a list ? thanks


Nov 18 '06 #8

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

Similar topics

4
by: Peter Mrosek | last post by:
Hello, I have the following declaration in an header file (abbreviated version): typedef struct { unsigned char rgbBlue; unsigned char rgbGreen; unsigned char rgbRed; unsigned char...
3
by: Z D | last post by:
Hello, BACKGROUND: ============== I've created a Windows User Control that contains an Image Control (among other controls). The user control handles the picture resize event. Whenever the...
4
by: Rob Richardson | last post by:
Greetings! I have a form with a listview, a menu, and a few text boxes, labels and command buttons. I want to resize the listview when the form is resized to that the widths of the spaces...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
12
by: Maxwell2006 | last post by:
Hi, I declared an array like this: string scriptArgs = new string; Can I resize the array later in the code? Thank you, Max
2
by: mrbrightsidestolemymoney | last post by:
Hi, I'm having a problem resizing a (very big) nested vector. It's not the most streamlined piece of code ever but I need this array to avoid having to recalculate the same quantity millions of...
3
by: Jim Langston | last post by:
I really am not sure if this question belongs in this newsgroup, but not sure where else to ask it. There is someone working on a game that I tested, and it was taking >30 seconds to load. He...
11
by: Ajith Menon | last post by:
I have created a windows application in which the form needs to be resized on the MouseMove event. The windows resize function takes a lot of CPU cycles. And as the resize function is called on the...
1
by: | last post by:
I'm creating a user control where the size always needs to be divisible by three. In the resize event within the custom control I'm having no problem maintaining the height to be the same as the...
8
by: infoseekar | last post by:
Image Resize & Rotation Hi I have 2 scripts, one for Image rotation and other image resize and they both are working. Image resize scripts load the picture and resize it and Image rotation...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.