Selecting Only Parts Of Text For Use (vb6 Coding)

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > VB Programming

Selecting Only Parts Of Text For Use (vb6 Coding)

Plenoptic
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.

Reply

ghostrider
QUOTE(Plenoptic @ Jul 14 2006, 10:03 PM) *

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?

Reply

pb-gnat
QUOTE(Plenoptic @ Jul 15 2006, 04:03 AM) *

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:
QUOTE
Private Sub Form_Load()

'additems to list1
With List1
.AddItem "abc", 0
.AddItem "def", 1
.AddItem "ghi", 2
.AddItem "jkl", 3
End With

'Name the Label1's
For x = 0 To 3 Step 1
Label1(x) = "Item #" & x + 1
Next x

End Sub

Private Sub List1_Click()

'restore the Label1 names
For x = 0 To 3 Step 1
Label1(x) = "Item #" & x + 1
Next x

'Set Label1's caption to the list1 selection
Label1(List1.ListIndex).Caption = List1.Text

'Text1's text is the selected item's name
Text1.Text = List1.Text

End 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.

 

 

 


Reply

Plenoptic
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.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : selecting parts text vb6 coding

  1. An Indepth Look At The Winsock Control (part Iii) - Part III - The Coding Begins (0)



Looking for selecting, parts, text, vb6, coding

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for selecting, parts, text, vb6, coding

*MORE FROM TRAP17.COM*
advertisement



Selecting Only Parts Of Text For Use (vb6 Coding)



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE