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

ListView how to change text

I need to change the text of my listview item (not a subitem) the
control will not have the current focus. I have tried the following
without any luck:

ListView1.Items[0].Text = "XXXX";

This does not work - please help!

Thanks,
Chris

Oct 20 '06 #1
3 3142
When I do this it works fine:

listView1.Items.Add("test");
listView1.Items[0].Text = "new test";

The text appears correctly as "new test".
Kelly S. Elias
Webmaster
http://devdistrict.com

ar********@gmail.com wrote:
I need to change the text of my listview item (not a subitem) the
control will not have the current focus. I have tried the following
without any luck:

ListView1.Items[0].Text = "XXXX";

This does not work - please help!

Thanks,
Chris
Oct 20 '06 #2
OK Maybe I need to be clearer:

function()
{
listView1.Items.Add("test");
}

function2()
{
listView1.Items[0].Text = "new test";
}

this is what is not working...

Cryptik wrote:
When I do this it works fine:

listView1.Items.Add("test");
listView1.Items[0].Text = "new test";

The text appears correctly as "new test".
Kelly S. Elias
Webmaster
http://devdistrict.com

ar********@gmail.com wrote:
I need to change the text of my listview item (not a subitem) the
control will not have the current focus. I have tried the following
without any luck:

ListView1.Items[0].Text = "XXXX";

This does not work - please help!

Thanks,
Chris
Oct 20 '06 #3
I see nothing wrong with that code. Where are you calling these functions?
What is the value of listView1.Items[0].Text inside function2 (set a
breakpoint and examine the value before and after)?

/claes

<ar********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
OK Maybe I need to be clearer:

function()
{
listView1.Items.Add("test");
}

function2()
{
listView1.Items[0].Text = "new test";
}

this is what is not working...

Cryptik wrote:
>When I do this it works fine:

listView1.Items.Add("test");
listView1.Items[0].Text = "new test";

The text appears correctly as "new test".
Kelly S. Elias
Webmaster
http://devdistrict.com

ar********@gmail.com wrote:
I need to change the text of my listview item (not a subitem) the
control will not have the current focus. I have tried the following
without any luck:

ListView1.Items[0].Text = "XXXX";

This does not work - please help!

Thanks,
Chris

Oct 20 '06 #4

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

Similar topics

2
by: John Lauwers | last post by:
I know you can edit the first column of the listview control, is there a way to edit the second and/or the other columns? greets John
6
by: VM | last post by:
How can I fill up a listview with text file contents? My listview has two columns and the first column fills up with a while loop: while (myString != null) { myString = sr.Readline();...
6
by: Joaquin Grech | last post by:
Hi I did alot of research on this on the web and msdn and I couldn't find anything. I have a listview showing as a grid (table looking, with rows and columns and no images at all, only text)....
2
by: Aron Henning | last post by:
I have a ListView that contains the subfoldes of a local drive. Whan i click on a subfolder the listbox should display the subfolders of this folder instead. the funktion is as follows: private...
0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
3
by: MikeY | last post by:
Hopefully someone can help me on this. I am using C#, making Windows forms. I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data,...
9
by: Devron Blatchford | last post by:
Hi there, Just wondering if I change the back and fore colour of a listview item when the mouse hovers over it? I want to overide the default windows colour. Can someone please tell me how to...
21
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
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...
2
by: Peter | last post by:
Hi, I have a problem with Listview using checkboxes. If i check items by code BEFORE the form is shown the Listview.Items are confused during the ItemChecked Event !!! After showing the...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.