IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Reply to this topicStart new topic

Selecting Only Parts Of Text For Use (vb6 Coding)


Plenoptic
no avatar
Trap Double Mocha Member
***************
Group: [HOSTED]
Posts: 2,310
Joined: 5-November 05
From: That one place over there...
Member No.: 13,830
myCENT:24.66



Post #1 post 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.
Go to the top of the page
+Quote Post
ghostrider
no avatar
Super Member
*********
Group: Members
Posts: 398
Joined: 9-June 06
From: Wisconsin
Member No.: 24,924



Post #2 post Jul 16 2006, 02:16 AM
QUOTE(Plenoptic @ Jul 14 2006, 10:03 PM) [snapback]266289[/snapback]

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?
Go to the top of the page
+Quote Post
pb-gnat
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 15
Joined: 12-July 06
Member No.: 26,493



Post #3 post Jul 17 2006, 10:12 AM
QUOTE(Plenoptic @ Jul 15 2006, 04:03 AM) [snapback]266289[/snapback]

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.
Go to the top of the page
+Quote Post
Plenoptic
no avatar
Trap Double Mocha Member
***************
Group: [HOSTED]
Posts: 2,310
Joined: 5-November 05
From: That one place over there...
Member No.: 13,830
myCENT:24.66



Post #4 post Jul 17 2006, 12:06 PM
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.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   4 noxit 9,004 19th June 2004 - 05:45 PM
Last post by: OpaQue
No New Posts   6 LuciferStar 11,475 7th November 2004 - 12:40 PM
Last post by: eldeo
No New Posts   6 Dagoth Nereviar 3,533 11th March 2007 - 11:38 PM
Last post by: jlhaslip
No New Posts   4 electriic ink 1,774 25th July 2006 - 07:28 PM
Last post by: electriic ink
No New Posts   7 -Cooper_NFFC- 5,115 11th October 2004 - 05:52 AM
Last post by: ashiezai
No New Posts   4 hansley 4,763 6th November 2004 - 11:03 PM
Last post by: ronin
No New Posts 9 kylelnsn 940 14th July 2006 - 02:18 AM
Last post by: gaea
No New Posts   2 BWiZ 2,753 6th November 2004 - 03:30 AM
Last post by: Fu Still Better
No New Posts   4 campusjunk 5,088 15th February 2009 - 10:34 AM
Last post by: flashy
No new   15 inverse_bloom 222 10th November 2009 - 08:23 AM
Last post by: The Simpleton
No New Posts   1 Alpha 2,812 19th November 2004 - 09:34 PM
Last post by: Swemetal
No New Posts   2 Vikash 3,388 15th September 2009 - 11:18 PM
Last post by: iG-Alyssa B. Velasco
No New Posts   11 mirage 5,404 4th July 2009 - 09:14 AM
Last post by: iG-JackARRR
No New Posts   3 Mr. Cheeky 2,556 1st June 2005 - 06:53 AM
Last post by: greendilim
No New Posts   3 lloydg 2,166 12th March 2009 - 04:01 AM
Last post by: Oblivion1500


 



RSS Open Discussion Time is now: 22nd November 2009 - 08:25 AM

Web Hosting Powered by ComputingHost.com.