Listview Subitems.. Ensurevisible??
How do I get a listview to scroll over so a sub item is visible?
Thanks!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ListView EnsureVisible!
Assume that a ListView has 20 items starting from Item1 to Item20. Also assume that at any given time, only 5 items can be seen in the ListView i.e. users have to scroll up & down to view the rest of the items in the ListView.
When a user types any item in a TextBox & clicks a CommandButton, that item gets selected in the ListView & to make sure that the typed item can be seen in the ListView (without scrolling the ListView), I am using EnsureVisible.
So for e.g. if a user types Item12 & clicks the CommandButton, Item12 will get selected in the ListView & will also be visible to the user i.e. he need not scroll the ListView to see the selected item which is Item12 in this case.
Now though EnsureVisible ensures that the selected item is visible, the selected item always becomes the last item among the list of items visible in the ListView at any given time. Since this ListView displays 5 items at a time, the selected item i.e. Item12 happens to be the 5th item in the ListView i.e. the ListView will look like this:
Code:
Item8
Item9
Item10
Item11
Item12
To view items between Item1 & Item7 & Item13 to Item20, one has to scroll the ListView.
Or if Item16 gets selected in the ListView, then Item16 will be the 5th item among the list of visible items in the ListView & the ListView will look like this:
Code:
Item12
Item13
Item14
Item15
Item16
To view items between Item1 & Item11 & Item17 to Item20, one has to scroll the ListView.
Instead of displaying the selected item as the last item among the list of items visible, I want the selected item to be shown somewhere at the center of the ListView so that the ListView looks like this:
Code:
Item14
Item15
Item16
Item17
Item18
How do I accomplish this?
Listview - EnsureVisible
Hi,
I want to scroll a listview so that a specific listitem is displayed at the top - EnsureVisible usually displays it at the bottom. Does anyone know how to do this?
TIA
Andy
Problem With Listview EnsureVisible
Hi, I have a Listview that contains files (their full paths) and I'm uploading them to a server. When I start uploading a file or it has finished, I'm changing the first SubItem and the SmallIcon of that row.
I'd like to make the Listview autoscroll to the file/row that is currently uploading, but every time the SmallIcon is changed the Listview refreshes, scrolls to the top and EnsureVisible is ignored.
I'm using the Listview from Common Controls 5.0.
vb Code:
lvw.ListItems(HoldListIndex(lIndex)).SubItems(1) = "200 - OK!"lvw.ListItems(HoldListIndex(lIndex)).SmallIcon = 4 'moves scrollbar to toplvw.ListItems(HoldListIndex(lIndex)).EnsureVisible 'seems to be ignored/bypassedGetNextFile Index
Listview.ensurevisible Method Not Working
Hi,
I am working on a form in which we can add a new person record
After adding the record to a table (acces) , i update 2 column in a listview on my form. Everything goes fine but the problem is that even
i use the lstitem.ensurevisible together with listitem.selected = true
the current entry does not become visible.
I've noticed something, when i debugged (step over line by line), the current entry becomes visible.
Anyone has an idea why this happens?
Code:
Private Sub txtRemark_KeyDown(KeyCode As Integer, Shift As Integer)
Dim Xlstitem As ListItem
'must generate new drID, update listview........
If KeyCode = vbKeyReturn Then
If MsgBox("Do you want to save ?", vbQuestion + vbYesNo) = vbYes Then
If txtSurname.Text = "" And txtName.Text = "" Then
MsgBox "FUll NAME of Doctor is needed", vbExclamation + vbOKOnly, "HALT"
txtSurname.SetFocus
Exit Sub
Else
AdoDr.Recordset.Fields!DrId = NewDrID
AdoDr.Recordset.Update
lblNumDr.Caption = AdoDr.Recordset.RecordCount
'Updating listview
Set Xlstitem = lstViewDr.ListItems.Add(, , AdoDr.Recordset.Fields!Surname + " " + AdoDr.Recordset.Fields!Name)
With Xlstitem.ListSubItems.Add(, , AdoDr.Recordset.Fields!DrId)
.ForeColor = vbRed
End With
Xlstitem.Selected = True
Xlstitem.EnsureVisible
End If
Else
AdoDr.Recordset.CancelUpdate
End If
End If
End Sub
Simple Listview Question (EnsureVisible)
I have a simple question regarding listview. I have listview populated with records in which the primary key of the records are stored in listview tag property. I use a popup form to add and edit the records in the listview. My question is how do I go back to the selected record after i edit a record.
Process flow: (edit mode)
1. I select a record in the listview for edit (ex. 10th row of the listview)
2. I open an edit form to edit the record
3. I press the Update button to save record
4. I unload the edit form
After updating the record the selected item goes to the first record of the listview. What i want is the cursor to go back to the 10th row (the edited record) and be selected/highlighted. I hope you getwhat i mean.
I tried this code after the rs.update of Edit Form.
VB Code:
MotherForm.listview1.FindItem Varbookmark , lvwTag
Note: VarBookmark is my variable for storing the primary key of the record (Variant Type data).
The code above doesn't work.....argggggg
any suggestions will be highly appreciated.
Moving A Listview Item And Its Subitems To A New Listview
Hey Guys,
Having a bit of trouble. I am attemping to move a selected item and its subitems from one listview to another. I have no problem getting the contents of the first column, but I can't seem to get the subitems over.
Example: I have this in the first listview:
Code:
|Item |Quanity|Price |PQ |
Bananas 2 $.50 $1.00
Then when I try to move that whole row to the other listview I can only seem to get this:
Code:
|Item |Quanity|Price |PQ |
Bananas
No subitems . Any links or help would be appreciated.
Regards,
Max_Power
Listview With Subitems
Hi,
I'm a newbee on VB 6.0 (old stuff I have to maintain ). Now I have this silly problem that I have a listview with 2 subitems. When I click on one item I would like to get the 1. subitem moved to a listbox. How do i do that?
Hope some can help me
Jan
Listview && Subitems
Hello, i tried some searching in the forum and also in the web. There must be possibilities to edit subitems.
"Garrett Sever" made something like this.
can anyone help?
okay, what i need is the following
listview with:
subitem - text
subitem - boolean value (best as checkbox)
both of them editable
any ideas?
ListView SubItems
I have a report type listview with one subitem column. I need to allow the user to select and change the information held within the subitem column. I can easily do it with the listitem column but I do not seem to be able to even select the subitem let alone edit it.
Thanks
Listview Subitems
hey agin, sorry for all the questions but i am stuck again.
i have a list box and i am loading an array into it. i can set the column headers and the first column but how do i set the subitems. i am using vb 6.0
here is the code i use to load the first colum
Code:
ListAdd.ListItems.Add , , Contact(0)
i need to load
contact(1) and 2
i have tried everything i could think of or get off the net. the examples from mdsn site did not work for me. thanks for the time. Pat
Listview/subitems
hi guys, just got a little stuck and im sure its a simple thing lol, well any way here is my problem, i have created a listview with 2 coulum headers
VB Code:
ListView1.ColumnHeaders.Add , , "Profile", 2970ListView1.ColumnHeaders.Add , , "Type", 970
ok, i have loaded everyting into the first coulum (profile) by useing
VB Code:
Set mItem = ListView1.ListItems.Add(, , "VISTER", , 1)
etc etc etc, now in the coulum header 2 (type) i can add the first bit of code to the first line
VB Code:
mItem.SubItems(1) = "Testl"
now how do i add to the next line down in coulum header 2? can you please help thanks..
ListView Subitems
In other apps where I've used the ListView i've added things like this.
VB Code:
Dim itmX as ListView Set itmX = ListView1.ListItems.AdditmX = Item1itmX.SubItems(1) = Item2itmX.SubItems(2) = Item3'etc....
However in a new app i've set everything up the same but when I try to complie to EXE i get a message saying "Method or data member not found" and the below code is highlighted. I can't figure out why it's not working
VB Code:
.SubItems(1)
ListView Subitems
Is it posable to display an Icon in a Subitem column of a ListView control in lvwReport view?
Thanks,
Alex
Listview And Subitems
Got a question for you all.
In this program a module called Recoredset.
This is the area of the problem.
---------------------------------------------------------------------
Public Sub Validate(UserName, Password As String)
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
Dim SQL As String
SQL = "Select * from Passwords where UserName = " & Chr(34) & UserName & Chr(34)
Rs.Open SQL, conn, adOpenKeyset, adLockReadOnly
With FrmBMServer
If Rs.EOF = True Then .sckServerWinsockConnection(.InitMax).SendData "InValid UserName": Exit Sub
If UCase(Password) = UCase(Rs!Password) Then
.sckServerWinsockConnection(.InitMax).SendData "Password Validated"
.lvUsers.ListItems.Add , , UserName
.lvUsers.ListItems(1).SubItems(1) = Count + 1
.lvUsers.ListItems(2).SubItems(1) = Count + 2 <- Right Here
Else
.sckServerWinsockConnection(.InitMax).SendData "InValid Password"
End If
End With
Rs.Close
Set Rs = Nothing
FrmBMServer.Label7.Caption = Err.Description
End Sub
---------------------------------------------------------------------
The line that has the arrow next to it is my problem.
I have a ListView set up and it has too columnheaders at the top. First column is UserName.
Second Column is Port Number.
What I want it to do is to put user name in the first column row and the port number in the second column row.
Im not sure on how to do this. There's got to be a way to check if column row's 1 2 3 etc are already filled, and if so add a new one plus need to figuer out how to put a counter in for the port numbers.
So it sould look somthing like this.
column Username | Column Port Number
-------------------------------------
Texg | 1
Bill | 2
ect...
Thanks for your help
TexG
Listview Subitems
Well, i just could not stay away from my code, and soon i found areas for improvement, so i´m back.. =)
This is similar to my other listview problem, but i can´t seem to figure it out. I have a listview with Headers
created by this code (thanks to XTab and DaVBMan). sOuput is used to make up the Headers of the listview.
Code:
ListView1.View = lvwReport
arrHeaders = Split(sOutput, ",")
For i = 1 To UBound(arrHeaders) + 1
ListView1.ColumnHeaders.Add
ListView1.ColumnHeaders(i).Text = Trim(arrHeaders(i - 1))
Next
I have a another comma separated file that i want to split and then use as subitems in the listview.
File might look like below, but is most likely much larger. I need to first get rid of the first line, then split
the file at every comma, and finaly add each "column" as a sub item in the listview. So in this case all three
"maverick" will go into the first column, bootstrap c: mp and index:maverick will go into the second
column and so on. Who´s got a tip to get me started? I´m really having som problems with my Split routines,
not to mention adding subitems in listviews, so all suggestions are welcome. =)
client,name,date-time
maverick,bootstrap,2004-10-05
maverick,c: mp,2004-10-05
maverick,index:maverick,2004-10-05
The file is read here, and i need to split it somewhere along this line and add the subitems.
Text10 is just used to test the code, i want to replace it with my listview.
Code:
Open "c: est.dat" For Input As #1
Do While Not EOF(1)
Label11.ForeColor = &HC000&
Label11.Caption = "Match found!"
Text10.Text = input(LOF(1), #1)
Loop
Close #1
End If
Edited by - Maverick2004 on 10/17/2004 10:55:45 PM
ListView SubItems
Does anyone know of a way to edit values in subitems? What I am trying to achieve is to have the listview populate with values from a table but to allow the user to edit those values and then read the information back to the table.
Listview Subitems Backcolor
Is there any way to change the backcolor of subitems in a listview? Something like this:
Code:
Do Until .EOF
Set itmX = Lvw1.ListItems.Add(, , Rs![F8])
itmX.SubItems(1) = Rs![F1]
itmX.SubItems(2) = Rs![F3]
itmX.SubItems(2) = Trim(itmX.SubItems(2))
itmX.SubItems(3) = Rs![F7]
itmX.SubItems(4) = Rs![F11]
itmX.SubItems(5) = Rs![F12]
itmX.SubItems(6) = Rs![F13]
If Rs![F6] = " " Then
For X = 1 To 6
itmX.Subitems(x).Backcolor = vbred '<=== of course does not work
Next X
End If
Edit Listview Subitems
Hi All,
in the attached picture is an example of the data that i displayed for the user to see in listview. how can i allow the subitems for editing by the users and save the edited datas.
i have searched through forum for similar examples to learn from. however, i am not able to find one. can anyone please help me in this area. thanks a million.
best regards.
Editing ListView SubItems
Is it possible to edit ListView's subitems by clicking on them twice like on the main item and also to select them by clicking only once? And how can I make one column editable and another readonly?
Selecting Subitems In A Listview
I want to make the program select an item of a listview when you click on one of it's subitems/columns. Does anyone know of a good way to do this?
Thx.
ListView's Subitems Question
I added items and subitems into Listview. But, I notice that I can only highlight the item portion (first column) in the Listview, and the subitem portion is inaccessible.
Could somebody give me some advice on how to make the subitem portion highligtable and editable? Thanks a whole bunch for your help. Have a great day!
Listview Tooltip Over SubItems Only?
I'm using this code I found here that works fine for showing each SubItem(1) text in a Tooltip for as the cursor moves over each one. I have 3 columns. Is there a way to show the SubItem(1) Tooltip only when the cursor is over one of the SubItem(1) and not the other columns?
Thanks
Code:
Dim objListItem As MSComctlLib.ListItem
Set objListItem = lstApp.HitTest(x, y)
If Not objListItem Is Nothing Then
lstApp.ToolTipText = objListItem.SubItems(1)
Else
lstApp.ToolTipText = ""
End If
Listview SubItems SmallICon Using ADO
Hi, This is a piece of the code I use to populate the Listview.
Code:
Sub FillListview
Do While Not rs.EOF
Set lvwItem = frmMain.ListView1.ListItems.Add(, , rs.Fields.Item("Field").Value, , "Users") ' << Users = name of Icon in ImageList
lvwItem.SubItems(1) = rs.Fields.Item("Field2").Value & vbNullString
lvwItem.SubItems(2) = rs.Fields.Item("Field3").Value & vbNullString
' ...... etc....
How do I add Icons (Images) to the Listviews Subitem?
I hope that it is possible.
Thanks in advance.
How To Edit Subitems In Listview Vb6?
Is there a way to edit a subitem in listview? I've been searching the forums regarding this but found none. I tried using label edit but i figured that only the 1st column can be edited. It would be nice if a subitem can be edited.
Any suggestions is highly appreciated.
thanks
Hittest On Listview Subitems
Is there any way of implimenting a hittest on listview subitems?
I have several columns open in a listview and when I scroll within the subitem area I want to know which record I am hovering over.
The problem being that when you move off of the main listview item the hittest freezes.
:mike:
Invisible Subitems In A ListView
Is it possible to add subitems to a listview such that they are not displayed (and occupy no space, i.e. there shouldn't be an "empty column")?
The purpose is I want this invisible subitems that musn't be shown to become automatically arranged when I click on a cloumn header to alphabetically arrange the text in each row.
Checkboxes In Listview Subitems
Is it possible to put checkboxes in a listview subitem?
I've seen code that allows you to put pictures in the sub items, but I would like checkboxes.
Thanks.
ListView: SubItems Or ListSubItems?
I have the following called from my Form_Load event.
VB Code:
Private Function Create_Headers() With lvwData .View = lvwReport .FullRowSelect = True .LabelEdit = lvwManual .SmallIcons = ilsImagesSMALL .Icons = ilsImagesLARGE .ColumnHeaders.Add , , "Code", 1000, lvwColumnLeft .ColumnHeaders.Add , , "Company", 2000, lvwColumnLeft .ColumnHeaders.Add , , "Address", 1500, lvwColumnLeft .ColumnHeaders.Add , , "Phone", 1500, lvwColumnRight End WithEnd Function
By using the following procedure I can add data to the ListView:
VB Code:
Private Function AddItem(ByVal Code As String, ByVal Company As String, ByVal Address As String, ByVal Phone As String, ByVal Icon As String)Dim lvwNewItem As ListItem Set lvwNewItem = lvwData.ListItems.Add(, , Code, Icon, Icon) With lvwNewItem .SubItems(1) = Company .SubItems(2) = Address .SubItems(3) = Phone End With Set lvwNewItem = NothingEnd Function
I know that by using ListSubItems I can achieve the same thing:
VB Code:
Private Function AddItem(ByVal Code As String, ByVal Company As String, ByVal Address As String, ByVal Phone As String, ByVal Icon As String)Dim lvwNewItem As ListItem Set lvwNewItem = lvwData.ListItems.Add(, , Code, Icon, Icon) With lvwNewItem .ListSubItems.Add , , Company .ListSubItems.Add , , Address .ListSubItems.Add , , Phone End With Set lvwNewItem = NothingEnd Function
How would I add data to the ListView using the ColumnHeader's KEY? As with the above I have to have the code in the correct order otherwise data will be displayed in the wrong column...
Any ideas?
Listview Subitems As Checkboxes
I am loading some database info into a listview.
This includes four columns of ture or false boolean values.
Instead of displaying 'True' or 'False' in these subitem columns I would prefer to just have a checkbox.
Is this possible? I can't seem to find any info on this.
Cheers.
Adding Subitems To A Listview
I have 2 ADOR recordsets that Im using to get data from 2 tables in a database. The first recordsets data is to be the first column in the listview. The second recordset to be the subitem. I have tried adding to the listitems text & subitem but only get output of one row. Can anyone please help?
Checkboxes In Subitems Of A Listview....?
Checkboxes in subitems of a listview....?
I dont have the time or motivation to play with all of the lv style constants. mfc will do it in c++ no problem, Unfortunanly our companys pc's are locked down tighter than any straight mans ass in america, so installing an .ocx is out of the question. Has anyone played enough or possibly heard in some strange conversation of listviews if this is possible?
Listview And Subitems Question
Hello,
I would like to change the text color in a Listview control for all the lines that are Ghosted but the problem is that the text color is changed only in the first column and not for all SubItems.
Thanks for your help,
Thierry Demoy
France
VB6
Remove Subitems From Listview
Ok, i have a listview which the user populates with a bunch of data, licenses to be exact.
I then loop through the listview and compare SubItems(1) with a database. If that item
already exists in the database, i want to remove it from the listview. The listview has 5
columns like below, and i want to clear each row corresponding to SubItems(1), not the
entire listview. I guess i should use ListView1.ListItems.Remove(index), but i´m having
some problems coding the index part so that the item/row the loop is currently on is
deleted. I guess i need to declare an integer that keeps count of the lines processed by
the loop? Any suggestions to this?
itm.Text itm.SubItems(1) itm.SubItems(2) itm.SubItems(3) itm.SubItems(4)
Code:
For Each itm In Me.ListView1.ListItems
objArs.QueryAddQualifier "Add on enabler", 1, itm.SubItems(1)
objArs.QueryAddQualifier "Status", 1, "Permanent"
objArs.QueryOpen
If objArs.GetEntryCnt() > 0 Then
List2.AddItem "Error! License " & itm.SubItems(1) & " already exists!"
' Code needed here to remove the row from ListView1
End If
Next
Cheers!
Maverick
Edited by - Maverick2004 on 12/2/2004 6:06:11 AM
Getting The Values Of Listview Subitems
Hi
I'm very new to VB6 so apologies if this is an obvious question....
I have a listview that has 4 columns. The first column which has an index of 1 according to the property page, is hidden by having its width set to 0. When the user clicks on a row in the listview, I want to be able to get the values from each of the columns and assign them to variables. But I'm having trouble. Here's my code:
Code:Private Sub lvwAudit_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim ind As Integer
Dim itm As ListItem
ind = Item.Index
cmdEditAudit.Enabled = True
AuditInfoID = lvwAudit.ListItems(ind).SubItems(1)
AuditCheckDt = lvwAudit.ListItems(ind).SubItems(2)
AuditNxtChkDt = lvwAudit.ListItems(ind).SubItems(3)
AuditCmnts = lvwAudit.ListItems(ind).SubItems(4)
End Sub
When using this code, the "lvwAudit.ListItems(ind).SubItems(1)" bit gets the value from the second column and misses out the first entirely. The "lvwAudit.ListItems(ind).SubItems(4)" is an invalid property. I tried changing the 1 to 0 to get the value from the hidden column but it says that is an invalid property as well. It's like it ignores the existence of the hidden column altogether!
Please can anyone tell me where I'm going wrong? Thanks!
ListView Problems ; Can't Get Subitems In The Right Row
I've searched everywhere looking for tut's on listview can't find much...
Maybe someone can help.. Its probably something stupid I'm doing but I can't figure it out..
I'm tring to add items and subitems to a listview.. I'm assuming that the subitems(are like the next column)
I can get the first column right but as soon as I try and add a sub item in its spliting my first column to everyother one
and the same with the sub items.. Like:
12345
abcde
678910
fghijkl
202122
This isn't what I want... I need them like:
12345 abcde
67890 fghijk
Here's my code, I'm getting the data from an array & database
I must be doing something wrong here
Code:
rsTblProd1.MoveFirst
For i = 0 To UBound(arrDeleted)
If arrDeleted(0) = "" Then
Exit Sub
End If
rsTblProd1.Find "[Product Code]='" & arrDeleted(i) & "'"
If rsTblProd1![Current Cost] = "0" Then
sCost = "0.00"
End If
With frmResults.lvw
.ListItems.Add , , rsTblProd1![Product Code]
.ListItems.Add.ListSubItems.Add , , rsTblProd1![Description One]
End With
Next i
Thanks for any inputsuggestions
$hep
Edited by - $hep on 10/9/2004 7:35:24 PM
ListView > SubItems > ForeColor
Hi, I've got a strange behaiver setting the ForeColor for SubItems in a ListView.
For some reason wich I can't seem to solve is, ones a SubItem is set to Blue it never goes back into a Black color.
Basically what I try to do is when selecting a row, set a certain SubItem ForeColor to Blue, and all other SubItems in the same column to Black.
But ones a SubItem is Blue, i can't seem to get it Black again.
Any suggestions?
Code:
' you need a ListView1 and Text1
Option Explicit
Private Sub Form_Load()
ListView1.Arrange = lvwAutoTop
ListView1.LabelEdit = lvwManual
ListView1.View = lvwReport
ListView1.FullRowSelect = True
ListView1.ColumnHeaders.Add , , "Icon", 400
ListView1.ColumnHeaders.Add , , "Unique ID", 1500
ListView1.ColumnHeaders.Add , , "Title", 3000
Dim i As Integer
For i = 1 To 5
ListView1.ListItems.Add , , "icon"
ListView1.ListItems.Item(i).SubItems(1) = "uID " & i
ListView1.ListItems.Item(i).SubItems(2) = "Title " & i
Next i
End Sub
Private Sub ListView1_Click()
Dim i As Integer
For i = 1 To ListView1.ListItems.Count
' make all "Title" columns black
' both methods don't work ...
ListView1.ListItems(i).ListSubItems(2).ForeColor = vbBlack
ListView1.ListItems.Item(i).ListSubItems(2).ForeColor = vbBlack
Next i
Dim h As Integer
h = ListView1.SelectedItem.Index
' set the selected "Title" column to Blue,
' this works, both methods ...
ListView1.ListItems(h).ListSubItems(2).ForeColor = vbBlue
'ListView1.ListItems.Item(h).ListSubItems(2).ForeColor = vbBlue
Text1.Text = ListView1.ListItems(h).ListSubItems(2).Text
Text1.SetFocus
End Sub
Edited by - T48 - [RedPlanet] on 9/13/2007 11:19:59 AM
Editing Subitems In Listview
Hi there !
I want to edit subitems in listview.
I click on the listview but the only thing i can edit is the parent column.
I also do not want the parent column to be editable.
Thank you !
ListView With Checkboxes As SubItems
I have scoured the Internet and MSDN, maybe I'm blind, but I can't find anything that tells me how to make checkboxes in my ListView subitems. I know that you can have a checkbox beside the item but that is not what I am looking for. I need checkboxes as subitem data. How can I make that happen?
Thanks.
Adding Pictureboxes To The Subitems Of A Listview
Hello, I'd like to add pictureboxes to the subitems of a Listview, so I can use them as a progressbar.
I can probably use SetParent to add pictureboxes to the Listview, but I have no idea how to keep the pictureboxes on the correct position when items are removed or the Listview is sorted.
Does anybody know how to do this?
Merge ListView Items && Subitems
I have LV1 with data and LV2 with updated data. I would like to delete the data in LV2 if it's the same in LV1. For the data to match and be deleted the items and subitems must match. Once the doubles are deleted I can just add to LV1.
The only problem is the deletion of doubles. Any help is greately appreciated.
Silver
Adding Icons To Subitems Of A Listview
Hi everyone!
I've tried searching in past threads to do this but failed. In my project, I use a listview with 4 columns and to fill it, I use recordsets from a table in the project's database. What I want to do is to add icons to certains rows in the listview and the icons are to be displayed in the 4th column of the listview. I really hope it can possibly be done.
Thanks a lot in advance for any help from any one of you.
Error 380 Using Listview Subitems Property
I am completely at a loss as to why this happens, but I have a small table that keeps track of reports. The information in this table is then displayed for the end-user, thus allowing them to choose a report from the list and view it. I filter by either unviewed reports only, or all reports. The problem is, when I try to list all unviewed reports, I get an error 380 "invalid Property value" when setting the subitems(i) = to something in the table. I can't say for sure, but it only seems to happen if the date viewed is empty. Even if I haven't got that far in the code!
Code:
Set rsReports = db.OpenRecordset(strSQL)
'Fill the listbox with the reports that have NOT been viewed
Do Until rsReports.EOF
If Not IsNull(rsReports![FILE]) Then
Set ItemX = lsvReports.ListItems.Add(, , rsReports![FILE])
If Not IsNull(rsReports![Date]) Then
ItemX.SubItems(conRptDate) = rsReports![Date]
Else
'The Date Should never be Null
ItemX.SubItems(conRptDate) = FileDateTime(ItemX)
End If
If Not IsNull(rsReports![Viewed]) Then ItemX.SubItems(conViewed) = rsReports![Viewed]
If Not IsNull(rsReports![From]) Then ItemX.SubItems(conSenderID) = rsReports![From]
If Not IsNull(rsReports![SORTDATE]) Then ItemX.SubItems(conRptSortDate) = rsReports![SORTDATE]
If Not IsNull(rsReports![SORTVIEW]) Then ItemX.SubItems(conRptSortViewed) = rsReports![SORTVIEW]
If Not IsNull(rsReports![BATCH]) Then ItemX.SubItems(conClaimsBatch) = rsReports![BATCH]
End If
rsReports.MoveNext
Loop
It crashes out when I try to assign the date (a non-empty field) I have tried other orders as well, and it does not matter which item is first. The conRptDate is a constant = 1 conViewed = 2 etc.
Thanks in advance for any help!
|