Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
7
Answers
Populate a richTextBox from a listView
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Robert Mabrey
14y
6k
1
Reply
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.
Post
Reset
Cancel
Answers (
7
)
Next Recommended Forum
Query Folder of Xml files
C# - jdownloader reconnection script