Anybody know how to change forecolor in listview control and also to enable full select. I found article on web about changing full select but could not get it to work. any help is greatly appreciated.
set col = Lv.columnheaders.add _(,,"ColumnName",Listview0.width / 5)
' "ColumnName is name of your column. Width is placed 'behind column. If you don't display the columns the user won't be able to move the lists. Use same statement for each additional column, changing your column name each time.
' loop your recordset
dim rs as adodb.recordset
dim cn as adodb.connection
set rs = new adodb.recordset
set cn = currentproject.connection
rs.open "SELECT * FROM TABLE",cn,adopenstatic
do until rs.eof
set itm = Lv.listitems.add(,,rs!Field)
' rs!field / name of field you want to put in column.
' for each additional column use this statement.
set itm = lv.subitems(1) = rs!field1
' change subitems(1) to subitems(2) and so on for each additional field.
' conditionally formatting listview.
itm.forecolor = vbred
' changes first column. Utilize If statement to conditionally format.
itm.listsubitems(1).forecolor = vbred
' change listsubitems(number) to reflect column you want to have the forecolor changed. Incorporate if statements with the following statements and you can change the color of the listbox.
' to get a value from the listview use this command on a click event,
me.listview0.selecteditem.text
' this will give you the value of the first column of your listview (listbox)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.