Plenoptic 0 Report post Posted July 15, 2006 Ok so I have a list and I am trying to make a click event that transfers the value of that item on the list to a text box to edit it. The only problem is I have a label for each item as Item 1: Item 2: etc; (not item exactly). So what I want to do is before the transfer is made have it select the "Item #" part and delete it so it is just the item name itself. It is sort of confusing but I was pretty sure it could be done. Any help would be appreciated. Share this post Link to post Share on other sites
ghostrider 0 Report post Posted July 16, 2006 Ok so I have a list and I am trying to make a click event that transfers the value of that item on the list to a text box to edit it. The only problem is I have a label for each item as Item 1: Item 2: etc; (not item exactly). So what I want to do is before the transfer is made have it select the "Item #" part and delete it so it is just the item name itself. It is sort of confusing but I was pretty sure it could be done. Any help would be appreciated. I've been programming in VB 6 for about 10 years now. I'm confused on exactly what you want. Could you explain it in different words? Share this post Link to post Share on other sites
pb-gnat 0 Report post Posted July 17, 2006 Ok so I have a list and I am trying to make a click event that transfers the value of that item on the list to a text box to edit it. The only problem is I have a label for each item as Item 1: Item 2: etc; (not item exactly). So what I want to do is before the transfer is made have it select the "Item #" part and delete it so it is just the item name itself. It is sort of confusing but I was pretty sure it could be done. Any help would be appreciated.I think I understand you. This is what I would do:Private Sub Form_Load()'additems to list1With List1.AddItem "abc", 0.AddItem "def", 1.AddItem "ghi", 2.AddItem "jkl", 3End With'Name the Label1'sFor x = 0 To 3 Step 1Label1(x) = "Item #" & x + 1Next xEnd SubPrivate Sub List1_Click()'restore the Label1 namesFor x = 0 To 3 Step 1Label1(x) = "Item #" & x + 1Next x'Set Label1's caption to the list1 selectionLabel1(List1.ListIndex).Caption = List1.Text'Text1's text is the selected item's nameText1.Text = List1.TextEnd Sub Just create an array of labels named Label1(four of them), a listbox named List1, and a textbox named Text1. I think it is pretty straight-forward. Share this post Link to post Share on other sites
Plenoptic 0 Report post Posted July 17, 2006 Thanks for the help, although I found a different way which did have some of yours in there. You see I had items in a list but also extra text before the item name so it was labled "Question 1 = xxxxx" That in quotations is the whole item on the list. I wanted to make it so when people double clicked on the item it would transfer just the "xxxxx" to the text box for editting which I ended up doing with a search and replace script for strings. Share this post Link to post Share on other sites