By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 2,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

Displaying arrays

P: n/a
I am just getting started in C#. What control do I use to display an array of
double?
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Rhea, you will need to use a loop construct for example:

for(int i = 0; i < myarray.Length; i++)
{
Console.WriteLine(myarray[i]);
}

Alex

"Rhea Bockhorst" <Rh***********@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
I am just getting started in C#. What control do I use to display an array
of
double?

Nov 17 '05 #2

P: n/a
A basic control you can use is a ListBox.

You can do the following:

// Add the control to the form. Your form will have a property like this in
the class.
private System.Windows.Forms.ListBox myListBox;

// Create a procedure to fill myListBox control
private void procedure(arrayList aList )
{
int i;
for (i=0; i< aList.Length; i++)
myListBox.Items.Add(aList[i].ToString()); // This will fill ListBox with
strings of the double values contained in the ArrayList aList

}

Hope this helps.

Carlos Lozano
www.caxonline.net

"Rhea Bockhorst" wrote:
I am just getting started in C#. What control do I use to display an array of
double?

Nov 17 '05 #3

P: n/a
I believe that you can just bind directly to the array as the list control's
data source as well -- Google should fetch you some examples.

BTW, when asking questions like this it's usually a good idea to specify
whether you are wanting info on Winforms or ASP.NET. It's also possible you
would get better answers in a newsgroup that is more specific to your
question, such as microsoft.public.dotnet.framework.windowsforms.dat abinding
or micorosft.public.dotnet.framework.windowsforms.con trols.

--Bob

"Carlos Lozano" <Ca**********@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
A basic control you can use is a ListBox.

You can do the following:

// Add the control to the form. Your form will have a property like this
in
the class.
private System.Windows.Forms.ListBox myListBox;

// Create a procedure to fill myListBox control
private void procedure(arrayList aList )
{
int i;
for (i=0; i< aList.Length; i++)
myListBox.Items.Add(aList[i].ToString()); // This will fill ListBox with
strings of the double values contained in the ArrayList aList

}

Hope this helps.

Carlos Lozano
www.caxonline.net

"Rhea Bockhorst" wrote:
I am just getting started in C#. What control do I use to display an
array of
double?

Nov 17 '05 #4

P: n/a
Thanks to Bob, Carlos and Alex for the quick response. It is clear that using
these newsgroups can make the trip into C# land a little less bumpy.

"Bob Grommes" wrote:
I believe that you can just bind directly to the array as the list control's
data source as well -- Google should fetch you some examples.

BTW, when asking questions like this it's usually a good idea to specify
whether you are wanting info on Winforms or ASP.NET. It's also possible you
would get better answers in a newsgroup that is more specific to your
question, such as microsoft.public.dotnet.framework.windowsforms.dat abinding
or micorosft.public.dotnet.framework.windowsforms.con trols.

--Bob

"Carlos Lozano" <Ca**********@discussions.microsoft.com> wrote in message
news:C4**********************************@microsof t.com...
A basic control you can use is a ListBox.

You can do the following:

// Add the control to the form. Your form will have a property like this
in
the class.
private System.Windows.Forms.ListBox myListBox;

// Create a procedure to fill myListBox control
private void procedure(arrayList aList )
{
int i;
for (i=0; i< aList.Length; i++)
myListBox.Items.Add(aList[i].ToString()); // This will fill ListBox with
strings of the double values contained in the ArrayList aList

}

Hope this helps.

Carlos Lozano
www.caxonline.net

"Rhea Bockhorst" wrote:
I am just getting started in C#. What control do I use to display an
array of
double?


Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.