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
Robert Mabrey
NA
7
0
Populate a richTextBox from a listView
Dec 9 2009 6:01 PM
I'm trying to populate a richTextBox from a listView for the means of printing address labels
richTextBox1.Text = listViewPrint.SelectedItems[0].Text;
richTextBox1.Text = listViewPrint.SelectedItems[0].SubItems[0].Text;
richTextBox1.Text = listViewPrint.SelectedItems[0].SubItems[1].Text;
richTextBox1.Text = listViewPrint.SelectedItems[0].SubItems[2].Text;
The above code will only populate the richTextBox with text from the third column in the listView. If you remove the last line such that
richTextBox1.Text = listViewPrint.SelectedItems[0].Text;
richTextBox1.Text = listViewPrint.SelectedItems[0].SubItems[0].Text;
richTextBox1.Text = listViewPrint.SelectedItems[0].SubItems[1].Text;
Only information from the second column is populated and so on. Is there a way to loop through this or maybe concatenate, or better code to use? Also I want it to format as follows
Name
Address
City, State, Zip
Thank You!
Actually after more thought It isn't necessary to populate a richtextBox when I can print directly from the listView. how could I do this in the obove format and again the same issue as above with populating the textBox. it will onlt print the last column.
Reply
Answers (
7
)
Query Folder of Xml files
C# - jdownloader reconnection script