TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chris W
NA
4
4.1k
Change text to edit in BeforeLabelEdit( ) event?
Mar 16 2006 2:55 PM
Does anyone know if it is possible in a ListView BeforeLabelEdit event to change the text that user is going to edit, just before the edit?
Here's my code. None of the items below (remmed out) work to change the text the user is going to edit. Any ideas are greatly appreciated!!
private
void
listView1_BeforeLabelEdit(
object
sender, System.Windows.Forms.LabelEditEventArgs e){
// Remove "(default)" from the template name
string
name =
this
.listView1.SelectedItems[0].Text;
if
(name.IndexOf(" (default)") >= 0)
{
// Remove the word
name = name.Substring(0, name.Length - 10);
// NONE OF THESE THINGS WORK TO FORCE USER TO MODIFY THE NEW TEXT!
//e.Label = name; // READ-ONLY!
//this.listView1.Items[e.Item].Text = name; // REMOVES (default) AFTER EDIT!
//this
.listView1.SelectedItems[0].Text = name;
// REMOVES (default) AFTER EDIT!
// Cancel event and refire it?
//e.CancelEdit = true; //DOES NOT WORK!
//listView1_BeforeLabelEdit(sender, e); //DOES NOT WORK!
}
}
Reply
Answers (
1
)
xml keys and value display on cosole
Single quotes conversion in c# or Javascript?