|
-
Jun 21st, 2004, 01:22 PM
#1
Thread Starter
Addicted Member
ListView Problems
I want to have a user select an item/items from a ListView Box, then click an update btn and have the selections appear in a text box. Here is what I got:
VB Code:
Private Sub btnWhile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWhile.Click
If lstParts.SelectedItems.Count = 0 Then
MessageBox.Show("You did not select any items", "Error")
Exit Sub
End If
If lstParts.SelectedItems.Count > 0 Then
txtLoop.Text = "You have selected: [COLOR=RED]THE ITEMS THAT WERE SELECTED[/COLOR]."
End If
End Sub
Last edited by twisted; Jun 22nd, 2004 at 07:32 AM.
Twisted
-
Jun 21st, 2004, 02:00 PM
#2
Frenzied Member
Off the top of my head I think SelectedItems is a collection. Just step through the collection and add the values to your string.
MyListBox.SelectedItems.Item(x)
Last edited by SeanGrebey; Jun 21st, 2004 at 02:10 PM.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jun 21st, 2004, 03:36 PM
#3
Hyperactive Member
Did you loose track of the original thread you were posting this in, I posted a completed block of code that does what you want.
btw, Using the StringBuilder class is recommended by Microsoft over concatenating strings....
The String object is immutable. Every time you use one of the methods in the System.String class, you create a new string object in memory, which requires a new allocation of space for that new object. In situations where you need to perform repeated modifications to a string, the overhead associated with creating a new String object can be costly. The System.Text.StringBuilder class can be used when you want to modify a string without creating a new object. For example, using the StringBuilder class can boost performance when concatenating many strings together in a loop.
Last edited by CyberHawke; Jun 21st, 2004 at 03:42 PM.
-
Jun 22nd, 2004, 06:30 AM
#4
Thread Starter
Addicted Member
See my LISTVIEW thread!!!
Sorry I did lose track of it and made some changes to the question...But I found it now!
-
Jun 22nd, 2004, 07:30 AM
#5
Sleep mode
It'd be helpful and useful to you and other guys, who encounter like this problem later, if you mention a descriptive thread title .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|