|
-
Jun 13th, 2006, 07:33 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Listbox - Take first item in list?
How do I extract the first line in a listbox? I know that to take data out you use lstBox.Text, but how do I automatically select line 1 before doing this?
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jun 13th, 2006, 07:35 PM
#2
Re: Listbox - Take first item in list?
VB Code:
Private Sub Command1_Click()
List1.ListIndex = 0
End Sub
-
Jun 13th, 2006, 07:41 PM
#3
Thread Starter
PowerPoster
Re: Listbox - Take first item in list?
This is very weird...because I tried that, and list1.listindex keeps on turning into -1 which is messing with the code I am trying to do :-)
Edit: Me doing my usual FUBAR stuff...t'was a bug elsewhere...the listindex is of course firing the list1_click which is doing stuff which ruins it all...easy to fix...thanks for the help :-)
Last edited by smUX; Jun 13th, 2006 at 07:58 PM.
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Jun 13th, 2006, 09:50 PM
#4
Re: [RESOLVED] Listbox - Take first item in list?
Just a point. You may want to check that there is something in the ListBox first:
VB Code:
Option Explicit
Private Sub Command1_Click()
If List1.ListIndex > -1 Then List1.ListIndex = 0
End Sub
-
Jun 14th, 2006, 05:44 AM
#5
Thread Starter
PowerPoster
Re: [RESOLVED] Listbox - Take first item in list?
 Originally Posted by Bruce Fox
Just a point. You may want to check that there is something in the ListBox first:
VB Code:
Option Explicit
Private Sub Command1_Click()
If List1.ListIndex > -1 Then List1.ListIndex = 0
End Sub
Yeah, I was doing that...the issue wasn't that, it was something to do with me using .removeitem afterwards in a sub which was messing with it or something
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
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
|