|
-
Aug 24th, 2001, 08:40 AM
#1
Thread Starter
Fanatic Member
Is there a better way??
Hi All,
I would like to have your input again to make sure I am coding things optionally.
1. When you know the key to an image in an imagelist is there a better way to add the image to a listview besides what I am already doing?
Code:
Set TempListItem = lvwObjects.ListItems.Add(, , ObjectsFound(i).Name)
For j = 1 To ImageList.ListImages.Count
If ImageList.ListImages(j).Key = ObjectsFound(i).ContentType Then
lvwObjects.SmallIcons = ImageList
TempListItem.SmallIcon = j
ImageFoundFlag = True
End If
Next jNext j
2. Is there a way to add two icons next to each other in a listview in report mode?
3. Is there a way to convert a 1 or a 0 to true or false in one line for a check box?
Code:
If Check1.Value = 0 Then
ListObjects1.ShowLockOwner = False
Else
ListObjects1.ShowLockOwner = True
End If
Again thanks all for your input!!
-
Aug 24th, 2001, 08:44 AM
#2
Member
For number 3: CBool(-(checkboxname.Value))
-
Aug 24th, 2001, 08:55 AM
#3
Thread Starter
Fanatic Member
Thank you. When your a lone programmer sometimes you miss the easy stuff.
-
Aug 24th, 2001, 08:59 AM
#4
Member
Originally posted by filburt1
For number 3: CBool(-(checkboxname.Value))
BTW, you'd use it like this:
VB Code:
If CBool(-([[i]checkboxname[/i].Value)) ' If true
Msgbox "Checked"
Else ' False
Msgbox "Not checked"
End If
-
Aug 24th, 2001, 09:03 AM
#5
Thread Starter
Fanatic Member
Courious why the minus sign?
CBool(-(checkboxname.Value))
Because this seems to work.
Code:
ListObjects1.ShowLockOwner = CBool(Check1.Value)
Originally posted by filburt1
For number 3: CBool(-(checkboxname.Value))
-
Aug 24th, 2001, 09:08 AM
#6
Member
VB is different from all other language in that -1 is True, instead of 1.
-
Aug 24th, 2001, 09:14 AM
#7
Thread Starter
Fanatic Member
If I use 1 or -1 in CBOL I get TRUE. No big deal just interesting.
-
Aug 24th, 2001, 09:24 AM
#8
1.
VB Code:
On Error Resume Next
Set TempListItem = lvwObjects.ListItems.Add(, , ObjectsFound(i).Name)
TempListItem.SmallIcon = ImageList.ListImages(ObjectsFound(i).ContentType).Index
If Err = 0 Then
ImageFoundFlag = True
End If
Best regards
-
Aug 24th, 2001, 09:41 AM
#9
Thread Starter
Fanatic Member
Thanks Joacim.
Let me reword question 2 then. If I can't add a second icon to a list view, can I add an icon to a column?
-
Aug 24th, 2001, 09:49 AM
#10
ListSubItems can have icons if you use VB6.
-
Aug 24th, 2001, 10:24 AM
#11
Thread Starter
Fanatic Member
Joacim,
Man thank you very much!!
You all are helping me to make one cool listview component!
I know this has been asked before but....
besides hooking the the listview is there a way to detect the resize of a column?
Originally posted by Joacim Andersson
ListSubItems can have icons if you use VB6.
-
Aug 24th, 2001, 10:32 AM
#12
Frenzied Member
BTW, for #3, VB makes that 1, -1 distinction automatically. You dont need to do CBool. Just do:
VB Code:
If Check1.Value Then
MsgBox "checked"
Else
MsgBox "unckecked"
End If
Or even better, because of VBs default properties, this works to:
VB Code:
If Check1 Then
MsgBox "checked"
Else
MsgBox "unckecked"
End If
You just proved that sig advertisements work.
-
Aug 24th, 2001, 10:34 AM
#13
Member
The checkbox has three values! Checked, unchecked, and grayed (sorta checked). So does If check for a non-zero as true? If that's the case, then grayed will be treated as checked.
-
Aug 27th, 2001, 07:49 PM
#14
Frenzied Member
damn...
You just proved that sig advertisements work.
-
Aug 27th, 2001, 07:50 PM
#15
-
Aug 27th, 2001, 09:19 PM
#16
Registered User
3.
VB Code:
ListObjects1.ShowLockOwner = Check1
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
|