|
-
Nov 21st, 2004, 02:49 AM
#1
Thread Starter
Addicted Member
Runtime Error 91
VB Code:
Function ShowDlg(ListView As ListView, ByVal Title As String) As Boolean
LVExporter.ListView = ListView
Dim selCount As Long, i As Long
'Determine count of selected entries
For i = 1 To ListView.ListItems.Count
If ListView.ListItems(i).Selected Then selCount = selCount + 1
Next i
Error Message: Runtime Error 91, Object Vairable or With Block Variable not Set.
When ever i run this code in another Poject than mine it works fine.
*The Code is in a ActiveX Control.
Can anyone give me some ideas of how the Code should be?
-
Nov 21st, 2004, 02:57 AM
#2
I don't know if this has anything to do with your problem, but possibly because you're using an object type as a variable name, ie ListView As ListView, VB is somehow getting confused. Try this:
VB Code:
Function ShowDlg([b]MyListView[/b] As ListView, ByVal Title As String) As Boolean
Change all your references to MyListView. Just a guess
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Nov 21st, 2004, 03:07 AM
#3
Thread Starter
Addicted Member
It still gives me the same Error.
-
Nov 21st, 2004, 03:14 AM
#4
Which line does the error occur on?
-
Nov 21st, 2004, 03:18 AM
#5
Thread Starter
Addicted Member
VB Code:
For i = 1 To ListView.ListItems.Count
That one
-
Nov 21st, 2004, 03:22 AM
#6
Perhaps you need to do this:
VB Code:
[b]Set[/b] LVExporter.ListView = ListView
And also you need to change this line:
VB Code:
For i = [b]0[/b] To ListView.ListItems.Count [b]-1[/b]
EDIT: Ignore the first bit of code, that's got nothing to do with it. Sorry.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Nov 21st, 2004, 03:59 AM
#7
Thread Starter
Addicted Member
-
Nov 21st, 2004, 04:11 AM
#8
Member
Currently I am working on listboxes myself. I am no wizzy about listboxes or ActiveX controls, I ain't even sure your dealing with a listbox.
VB Code:
For i = 1 To ListView.ListItems.ListCount
Maybe that works, best wishes Forge.
-
Nov 21st, 2004, 04:19 AM
#9
Thread Starter
Addicted Member
In a ListView you can not use ListCount only Count, but thanks for your help
-
Nov 21st, 2004, 11:20 AM
#10
Show the code that calls this function. The problem lies there.
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
|