Any C# Programmers out there?

Man of Honour
Joined
17 Feb 2003
Posts
29,640
Location
Chelmsford
Hi, Pretty new to C# so bear with here.. I'm trying to create a form which shows a list of balances in a listbox.. but I can't find a way of aligning the currency fields in neat columns .. i.e. right justified but aligned with the previous entry.

Any ideas who I can do this or any other way of presenting the list?
 
I'm assuming this is WinForms rather than WPF/ASP.NET/anything else?

It's been a while since I've used WinForms, but isn't there a TextAlign property or something on the control?
WPF makes this a whole lot easier if it's an option to use that (but you then have the WPF learning cliff to deal with!)
 
ah Apparently i can use listview:

Code:
 string[] row1 = { "s1", "s2", "s3" }; 
 listView1.Items.Add("Column1Text").SubItems.AddRange(row1); 
,

However i only stiil getone column..

same here:

Code:
   ListViewItem item1 = new ListViewItem("Something");
            item1.SubItems.Add("SubItem1a");
            item1.SubItems.Add("SubItem1b");
            ListViewItem item2 = new ListViewItem("Something2");
            item2.SubItems.Add("SubItem2a");
            item2.SubItems.Add("SubItem2a");
            ListViewItem item3 = new ListViewItem("Somethin3");
            item3.SubItems.Add("SubItem3a");
            item3.SubItems.Add("SubItem3a");

            listView1.Items.AddRange(new ListViewItem[] { item1, item2, item3 });
 
Last edited:
Have you created the columns?

Create the columns like this before adding the items.

Code:
listView1.Columns.Add("ColumnHeading1");
listView1.Columns.Add("ColumnHeading2");
listView1.Columns.Add("ColumnHeading3");
 
Hey Stelly,

Gotcha.. Many thanks I just may take you up on that. I attended a course a few weeks ago. The whole Object Orientation thing is a bit alien to me coming from a iSeries background so I'm just toying around at the moment. We are thinking of re-writing some of our systems to use C#/.NET in the near future.
 
Hey Stelly,

Gotcha.. Many thanks I just may take you up on that. I attended a course a few weeks ago. The whole Object Orientation thing is a bit alien to me coming from a iSeries background so I'm just toying around at the moment. We are thinking of re-writing some of our systems to use C#/.NET in the near future.

Ok dude... :)

Have been programming in C# since I was in uni, about 2001 so nothing new to me mate :D

Happy to help

Stelly
 
Back
Top Bottom