Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
| Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 9th, 2009, 03:13 PM
Registered User
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default ListBox selected item retrieval help


This is my first time posting on this site and I am a beginner VB programmer. I have been able to solve many of my previous questions through existing threads but have not found what I need to solve this problem. My problem is that I have a listbox on my main sheet that I can successfully import data to but am having trouble retrieving the selected items and using them in further calculations. Where I am having the biggest problem now is in the following piece of code:

 Visual Basic 4 / 5 / 6 Syntax
Dim lItem As Long
Dim Count As Integer
Set Count = Set_Listbox.ListCount              (Problem here!!!)
For lItem = 0 To Count - 1
      If ListBox1.Selected(lItem) = True Then
            Sheets("Main").Range("A65536").End(xlUp)(25, 7) =              ActiveSheet.Shapes("Set_Listbox").List(lItem)
            ActiveSheet.Shapes("Set_Listbox").Selected(lItem) = False
      End If
Next lItem
I am getting the error that an object is required and after over 4 hours of trying to look for existing threads on the subject, I have not found much help. Any help will be greatly appreciated. If this is the wrong forum, I apologize.

Thanks a lot,

  #2 (permalink)  
Old October 19th, 2009, 07:17 AM
Registered User
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

I posted this same problem on another forum and received 9 responses whereas on this forum I received none. My problem is solved. Thanks anyway.
  #3 (permalink)  
Old October 21st, 2009, 09:16 PM
Registered User
Join Date: Oct 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

OK What other forum.
That is good info too!
  #4 (permalink)  
Old October 22nd, 2009, 07:37 AM
Registered User
Join Date: Oct 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

DaniWeb is the other forum.
  #5 (permalink)  
Old October 23rd, 2009, 01:01 AM
Authorized User
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts

For a nice listing of forums see... http://www.daniweb.com/forums/thread214396.html

Good Luck

PS. vbforums has the highest traffic

Similar Threads
Thread Thread Starter Forum Replies Last Post
unselect all other items in listbox when certain item selected Hughesie78 Pro VB.NET 2002/2003 1 February 23rd, 2009 07:40 AM
Chapter 5 GridView Selected Item stoverje BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 2 August 8th, 2008 03:11 PM
How to get selected item from listview? try.test.abc C# 1 January 4th, 2007 02:34 AM
Datagrid - Scroll to selected item rodmcleay ASP.NET 1.0 and 1.1 Professional 2 February 21st, 2005 08:36 PM
How to get selected Item from Listbox? Iceman571 ADO.NET 1 March 25th, 2004 06:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.