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

ListView row numbers?

I am trying to provide a list to the user. This list is the 1st 25 lines of
a given file. I want to provide the line number to the user, before each
line.

I see when I add Columns to a ListView, the way I want it to look. The
numbers appear fixed, and only show up for given lines.

What control are they using to accomplish this, and how is it configured?

I have been trying to get TextBox, ListBox, ListView, and DataGrid to do
this, but to no avail as of yet.

Any pointers would be greatly appreciated. I have not found anything
related to this on MSDN yet.

Andrew S. Giles
Nov 17 '05 #1
1 4927
How are you adding your data to the ListView?

Using a custom class called Foo that has two string properties, A and B, and
building an array of Foos called fooArr and making sure that the View
property of the ListView is set to Details and that the desired number of
columns has been specified... you can do the following to add items to the
ListView and have each line be prefixed with a line #.

int x = 0;
foreach(Foo f in fooArr)
{
x++;
listView1.Items.Add( new ListViewItem( new
string[]{x.ToString(), f.A + " " + f.B, }) );
}

Is this more or less what you are trying to do?

Brendan
"Andrew S. Giles" wrote:
I am trying to provide a list to the user. This list is the 1st 25 lines of
a given file. I want to provide the line number to the user, before each
line.

I see when I add Columns to a ListView, the way I want it to look. The
numbers appear fixed, and only show up for given lines.

What control are they using to accomplish this, and how is it configured?

I have been trying to get TextBox, ListBox, ListView, and DataGrid to do
this, but to no avail as of yet.

Any pointers would be greatly appreciated. I have not found anything
related to this on MSDN yet.

Andrew S. Giles

Nov 17 '05 #2

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

Similar topics

2
by: Randy Birch | last post by:
Reposted as the original is reported as deleted from the server. re: MSComCtl Listview control cashes after installing VB6/VS6 SP6 I have been advised that this problem has been reproduced...
6
by: Patrick De Ridder | last post by:
In a list view with various columns with numbers, I would like to give a few numbers a different color. I would be happy to know how can it be done. Many thanks. -- Regards, Patrick.
0
by: Navin | last post by:
Hi, I am making a code editor in C# and want to display line numbers to the left. I have a UserControl with a ListView docked to the left edge and a TextBox that makes up the rest. I am able to...
4
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
6
by: ReMEn | last post by:
My question is this: How can I apply some kind of a function to a listview that allows it to sort by both string and numbers whenever a header is clicked? For example: -------------------...
5
by: billuy | last post by:
Is there a way to sort by a specified column in a listview? I'd like my users to be able to click on the column heading and have the listview sort by that column. Thanks, Billyb
7
by: BobAchgill | last post by:
I am trying to decide which of these controls to use to implement letting my user select a full row from MyList. The MyList has several columns which would be nice to sort by at run time. The...
18
by: mrshrinkray | last post by:
Are there any know bugs with the ListView in .NET 2? I'm having problems with an application that takes 15 seconds in 1.1, and now takes over a minute. The code in question uses: listViewItem =...
12
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...

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.