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

can't use an array property of a user control in designer?

Hi,

I have a user control and I want an array of items to be available to
the user

In my case these items are a class called Needle.
I added a property called Needles to get\set the array (Needle[]) and
it seems to work except that the designer doesn't handle it correctly

In the property page of the designer I see the property and I can
click on it and I get a property window and I can add new Needles.
These are thrown away, they never make it to the cs file and I don't
know why.
The will remain in the design property page until I close VS or
compile.

I have put the code in the Form_Load() to set the array and it works
but the property page does nothing

The code is below, {1} is where I would expect the designer to have
inserted code (similar to {2}) to create the objects.

Anyone have any idea what is wrong?

Vin

/// <summary>
/// Form Code
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private QuickTest.MultiNeedleSlider multiNeedleSlider1;

private void InitializeComponent()
{
//
// multiNeedleSlider1
//
this.multiNeedleSlider1.Location = new System.Drawing.Point(48,
24);
this.multiNeedleSlider1.Name = "multiNeedleSlider1";
this.multiNeedleSlider1.Size = new System.Drawing.Size(312, 72);
this.multiNeedleSlider1.TabIndex = 3;
// {1} would expect the Needles to be new'd here!
}

private void Form1_Load(object sender, System.EventArgs e)
{
// {2} This works perfectly
QuickTest.MultiNeedleSlider.Needle nn = new
QuickTest.MultiNeedleSlider.Needle();
nn.Color = Color.Red;
multiNeedleSlider1.Needles = new
QuickTest.MultiNeedleSlider.Needle[1] {nn};
}
}

//////////////////////////////////////////////////

/// <summary>
/// User Control Code
/// </summary>
public class MultiNeedleSlider : System.Windows.Forms.UserControl
{
private Needle[] m_aNeedles;

public Needle[] Needles
{
get
{
return m_aNeedles;
}
set
{
m_aNeedles = value;
}
}

// begin class Needle
public class Needle
{
private System.Drawing.Color m_colour;

public Needle()
{
m_colour = Color.Black;
}
public System.Drawing.Color Color
{
get
{
return m_colour;
}
set
{
m_colour = value;
}
}
} // end class Needle
}

Nov 16 '05 #1
0 1546

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

Similar topics

0
by: Colin | last post by:
Hi there, I really need your help on this. I'm trying to learn to using the VS.2003 to create a User Control. In my aspx code has no problem to use the property "grossWaye" that has "register" in...
2
by: gce | last post by:
What happens : When I first press the button, I get an listbox1 with a,b,c (correct: because of the addtoa(1, "a") addtoa(2, "b") addtoa(3, "c") When I check the checkbox, the eventhandler...
4
by: c676228 | last post by:
Hi all, In the second web form, I have the following code: (The peopleinfo is a user control which has name and ssn infomation, each field in this user control I have set enableviewstate=true). I...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.