Listview + Report View + Colour
Can I make subitems have different backcolors or forecolors to them?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listview(view=lvwreport) Set Colour
In a Listview Report, how can I set colour on a selected ROWs based on inputed data.
e.g. if "Year = 2001" is red colour OR if "Year = 2003" is blue colour.
Thank you in advance
Help About ListView Report View
How can I add a new item to a particular column in report view? For example I have a columns named First and Second, I want to add an item to the Second column and not in First. Please tell me how. Please. Please. Please.
Listview - Report View With Icons?
Is it true that is you have the listview's view set to 3 (lvwReport) that it can't show icons?
I have a imagelist on a form with a picture in it. The picture has a key. I set the listview's icons and small icons to this imagelist. I tryed to add the picture to a listview menu item and used its key.
Didn't work. Any suggestions?
Right To Left ListView? (Report View)
I've tried implementing a right-aligned listview (comctl 6.0), but without any effect.
The listview is in report view mode.
Running WinXP. Shell language is Hebrew.
Code:
OldExStyle = GetWindowLong(lvwLearn.hWnd, GWL_EXSTYLE)
OldExStyle = SetWindowLong(lvwLearn.hWnd, GWL_EXSTYLE, OldExStyle _
Or WS_EX_LEFTSCROLLBAR Or WS_EX_RIGHT Or WS_EX_RTLREADING)
There is no apparent change to the listview, even though the call succeeds.
Does anyone have a solution?
ListView (Report View) Troubles...
I have a list view that can contain alot, a few, or no values at all at any given time.
The box will display existing information in row 1, then in row 2 it will display the information that will overwrite the existing information (if the user chooses). Then the 3rd will be existing, 4th new, 5th existing, 6th new, etc...
The grid goes in pairs, and the check boxes are turned on. By default nothing is checked. I want the user to be able to click whatever they choose, if they check the box on an odd row, then all the text in every cell of that row will go bold, and the entire row after that cell will lose its bold font (incase it was selected before). The rows look like this:
1 asdfas as as dasdfasf asdf
1 asdf asf asdf asdf asd fasf asd
2 asf asdf asdf asf asf asdf asdf
2 asf asd fasdf asd fasdf asdf asdf
3 asdf asdf asf asf asdf asdf asdf
3 asdf asdf adsf adsf as fasd
4 adsf asdf sdf asf sa dfas fasdf as
4 asdfasdfa sdf asdf as fafs
Of course with check boxes to the left of the numbers, if i click the 2 on the bottom, it will go bold and the 2 above it will be unchecked and go back to non-bold font. I know this is possible, im pretty close already.. Here's what i have:
Code:
Private Sub lvConflicts_ItemCheck(ByVal Item As MSComctlLib.ListItem)
Dim MyCount As Integer
If Item.Checked = True Then
Item.Bold = True
For MyCount = 1 To 8
Item.ListSubItems.Item(MyCount).Bold = True
Select Case Right(Item.Index, 1)
Case Is = 1, 3, 5, 7, 9
Item.ListSubItems.Item(MyCount).ForeColor = vbBlack
lvConflicts.ListItems(Item.Index + 1).ForeColor = &H808080
lvConflicts.ListItems(Item.Index + 1).Checked = False
Case Is = 0, 2, 4, 6, 8
Item.ListSubItems.Item(MyCount).ForeColor = vbBlack
lvConflicts.ListItems(Item.Index - 1).ForeColor = &H808080
lvConflicts.ListItems(Item.Index - 1).Checked = False
End Select
Next MyCount
Else
Item.Bold = False
For MyCount = 1 To 8
Item.ListSubItems.Item(MyCount).Bold = False
Select Case Right(Item.Index, 1)
Case Is = 1, 3, 5, 7, 9
Item.ListSubItems.Item(MyCount).ForeColor = vbBlack
lvConflicts.ListItems(Item.Index + 1).ForeColor = &H808080
Case Is = 0, 2, 4, 6, 8
Item.ListSubItems.Item(MyCount).ForeColor = vbBlack
lvConflicts.ListItems(Item.Index - 1).ForeColor = &H808080
End Select
Next MyCount
End If
End Sub
Im practically doing it already, i know it.. I think im just thinking too hard.. ive been working too long on this
Listview (report View) Scrollbars
I can't seem to figure this out: how do I add vertical and horizontal scroll bars to a Listview control with its "View" property set to "lvwReport"? I have tried many thing ... but none seem to work.
Icons In Listview In Report View
Hi, I am having trouble trying to display icons in a listview. I am displaying the listview in report mode and I have all the imagelists properly bound. If im not mistaken, the icons used in the report view use the 'small' imagelist, correct? Anyway I am populating the imagelist by creating a ListItem variable and setting it to Listview1.Add each time through the loop. Could this be the problem?
Moving Columns On A Listview (Report View)
I want to programmatically set the Position of the columns in a list view.
This is an "after thought" so I am trying to do it on already loaded listviews.
I see from a little experimentation that I can easily move the column headers by simply changing the .position property.
But that does not bring over the data for that column. (Just the header)
Do I have to manually move the data or there an easier way?
(By "manually move the data" I mean set up a temp array, copy the column's data, update new column after moving other column into original col number)
Regards,
ListView Report Mode View - RESOLVED
When I change to report mode view nothing is showing up in my listview. When I change it to List view my data shows up. Any ideas?
VB Code:
Private Sub LoadTableSpecs() Dim oSQLServer As New SQLDMO.SQLServer Dim oSQLDatabase As New SQLDMO.Database Dim oSQLTable As New SQLDMO.Table Dim oSQLColumn As New SQLDMO.Column Dim i As Integer Dim liObject As ListItem ListView1.ListItems.Clear oSQLServer.LoginSecure = True oSQLServer.Connect Form1.cboServer1.Text Set oSQLDatabase = oSQLServer.Databases(Form1.cboDatabase1.Text) Set oSQLTable = oSQLDatabase.Tables(Form1.cboTable1.Text) For Each oSQLColumn In oSQLTable.Columns Set liObject = ListView1.ListItems.Add(, , oSQLColumn.Name) liObject.SubItems.Add , , oSQLColumn.Datatype liObject.SubItems.Add , , oSQLColumn.Length Set liObject = Nothin Next oSQLServer.DisConnectSet oSQLServer = NothingEnd Sub
ListView (Report View) - Adding Items
AH! This is embarassing yet very frustrating. The last time I worked with the list view control was a loooong time ago. Unfortunately, I lost that project when my computer crashed (no big deal really, the program was never even completed). At any rate, how the heck do I add subitems and items to a report view listview?!
eg
Column 1 Column 2
Add Item Add Item
Add Item Add Item
ListView (Report View) Numeric Sorting
Hi,
I have a listview control in report view, and I have it so that when I click on a columnheader it sorts the list items by that column, the problem is that when I do that on a numeric column its sorts it like this
1
11
2
3
3100
4
...
I was wondering how can I make it so it sorts the column correctly
1
2
3
4
11
3100
Let me know if you know a way
Thanks In Advance,
Zmei
Edited by - Zmei2004 on 8/29/2004 8:45:42 AM
Last Column Width In Listview (report View)
Hi,
Does anyone know an easy way I can make the width of the LAST column header in a 'report view' listview automatically be equal to the space available.
ie,
if the other columns take up half the width of the listview, the last column takes up the other half.
Similary, if the width of one of the other columns changes, the width of the last column is automatically changed appropiately (so there is never a horizontal scroll bar).
Thanks in advance for any help you can give me.
Tom.
Last Column Width In Listview (report View)
Hi,
Does anyone know an easy way I can make the width of the LAST column header in a 'report view' listview automatically be equal to the space available.
ie,
if the other columns take up half the width of the listview, the last column takes up the other half.
Similary, if the width of one of the other columns changes, the width of the last column is automatically changed appropiately (so there is never a horizontal scroll bar).
Thanks in advance for any help you can give me.
Tom.
Editing Selected Item In ListView In Report View
How can I edit the second column of data in a listview control? I am making a properties box much like the one you use in VB. The first column information for each item can not be editable but the second column is going to be the value for each item and I need for it to be able to click and type in it just like in VB (or at least similar to that).
Any help and sample code is appreciated. Thanks.
*solved*I Wanna Learn ListView In Report View
hi this is a new thread after advice on moving from Picture1 to now i believe ListView in Report view is the way to go.
Metallisoft can you help me get his going. I have attached form1 to download and change as i can't get it to work. your reference click here hasnt helped me as it gave me 3 values i only need 2
Database eg
Quote:UNIVERSAL OEM MFG
16190 2-1428-HI WAI
16190 SJ-0001R AIM
16190 91-25-1030 WILSON
16190 S9024 LUCAS REMAN
16190 9821006350 ISUZU
16190 9821006060 ISUZU
16190 S114-136 HITACHI
16190 S114-100 HITACHI
16190 SR198X BOSCH REMAN
16190 94022494 GENERAL MOTORS
16190 RXS056 OEX
16190 94021044 GENERAL MOTORS
16190 S114-118 HITACHI I Don't need to display the UNIVERSAL Numbers Just OEM anf MFG only
Code:Private Sub Command3_Click()
Set rs = New ADODB.Recordset 'this will be the rs
Dim strSQL As String 'this the source
'make the selection string: filter the records right away
strSQL = "SELECT C.* FROM OEMS AS C where UNIVERSAL in(select UNIVERSAL from OEMS where oem='" & UCase$(Text1) & "')"
' To hold a reference to the current Listitem (row).
Dim oLVItem As MSComctlLib.ListItem
' The (Listview.Width - 350) / 3 simply adjusts the column
' widths to 1/3 the width of the Listview (subtracting the
' width of the scrollbar)
' ListView.ColumnHeaders.Add , , "Supplier", (ListView.Width - 350) / 3 '<- Don't need to work?
ListView.ColumnHeaders.Add , , "OEM", (ListView.Width - 350) / 3
ListView.ColumnHeaders.Add , , "Manufacturer", (ListView.Width - 350) / 3
Picture1.Cls
Picture1.FontSize = 8
Picture1.Font.Bold = True
Picture1.Print ">> Supplier Information"
Picture1.Font.Bold = False
Picture1.Print "OEM:"; Tab(20); "Manufacturer:"
rs.Open strSQL, oConnection, adOpenStatic, adLockOptimistic, adCmdText
'loop through the recordset
Do Until rs.EOF
M19 = rs("OEM") 'Are m19 and m20 properties or local variables? didn't want to take them out, but if they are global settings and there are more records, they will only 'remember' the values in the last record.(No they are strings in a database)
M20 = rs("MFG")
Picture1.Print M19; Tab(20); M20
rs.MoveNext
Loop
rs.Close 'Close the recordset never leave it open!
Set rs = Nothing 'clear the rs variable
End Sub
OK NOW how do i replace the Picture1 to ListView in Report view after reading MSDN click here CAN anyone save me? the ColumnHeaders don't display too?
Edited by - Hopeless on 6/4/2004 12:16:16 AM
ListView Control. How Do You Extractupdate Values In Report View
I have populated my ListView control with my values using DAO. I have 10 columns set up in report view. In my code fragment below, I am looking through my listview control searching for rows that the user has selected. Now I need to be able to extract some of the sub values and update others. How do I do this? Here is my code so far.
Private Sub SelectedCountCommand_Click()
Dim i As Integer
For i = 1 To ListView1.ListItems.Count
If ListView1.ListItems(i).Selected = True Then
'extract values from col 3 and 4 and subtract them
'update column 5 based on the results of col 3 minus col 4
End If
Next
End Sub
Help: How To View Selected Items From Listview With Crystal Report Viewer
Hi
I have a Listview with check boxes from it want to view selected items with crystal report viewer.
Private Sub cmdView_Click()
Dim lCustomerId as Long
Dim tmpItm As ListItem
For Each tmpItm In lstItems.ListItems
If tmpItm.Checked = True Then
lCustomerId = Val(Replace(tmpItm.Key, "C", ""))
End If
Next
End Sub
Plz. help
regards
How To Colour A List View
Is it possible to have the text or background colour in one particular cell in a list view to be of a certain colour??
I have a colum in a listview that keeps track of a job status and places ACCEPTED, ON SITE, CLEARD DOWN in that collum for each job depending on that jobs current state.
However i would like the text to be colourd as well.
Any help would be great, thanks in advance.
List View Row Colour
Is it possible to set the background colour for individual rows of a list view control (not a list box). I want to alternate the row colour of list items.
Data Grid View Colour
Hey,
Basically I’m creating a stock control system using visual basic, for one of my forms I am displaying data from a database table using a data grid view. The code I am using to display this data is as follows:
vb.net Code:
Imports System.DataImports System.Data.OleDbPublic Class Form3 Dim con As New OleDbConnection Dim da As OleDbDataAdapter Dim ds As New DataSet Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=StockSystemDatabase.mdb" da = New OleDbDataAdapter("SELECT * FROM tblStock", con) da.Fill(ds, "Stock") DataGridView1.DataSource = ds.Tables("Stock")
Now this code ^ works all well and fine and produces the data grid view like so:
http://img520.imageshack.us/img520/1746/datagz4.jpg
Now basically, I want for the stock items with no quantity (eg. Oil Lubricant) to have their whole row to be shaded in red so they are easily visible. How would I go about this and what code would I need to include to change the row colour to red.
Thank you
Tree View : Node Colour
Howdy
I know I can change the colour of an indervidual node, but can I have one node containing different colours ie:
Some Text Here More text here
Something like Outlook, when you have mail the inbox looks Like
Inbox (12)
Cheers
Geoff
Colour Text In List View
Hi, I know that we can set color for the text in listview, which will affect ALL the text in that particular listview, well, my question is, is it possible i only set the colour of the text for a specific cell only?
Let's say i have a listview with vie set to lwReport, and I list a list of file names of files to be deleted. beside each file name there is another column, call the delete status, here, i will show whether the deletion is success (in green), and fail (in red)...
Is it possible?
Tree View-node Colour And Multiline
I've just started using the treeview control, got it working etc but can anyone tell me if its possible to change the backcolor of an individual node and if you can change the text colour of an individual node?
Also is there anyway you can get a node to display multiline text??
thanks
john
Listview Colour
a simple one...
is there a way to change the backcolour for just one list item, so far i am aving to change to forecolour, but need more colours?
Is this possible? or are there any alternatives?
Listview Colour ?
I know with list views you can set the .forecolor and change the colour of the text, but is there a way to change one row's text colour to something different than the rest of text.
Cheers
Ian
ListView Background Colour
Hello
My first post in this forum, so nice to meet you all!
I want to selectively set the background colour of items in a list view, so that the user can easily differentiate between various categories of items.
The standard:
SendMessage(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal lStyle)
unfortunately seems to set the whole lot to just the one colour.
Is it even possible?
Thanks
Tarik
ListView Selection Colour
Hi Guys,
Does anyone know of a way to change the selection highlight colour in the ListView control? I have the ".HideSelection" property to "False" and the current colour is a boring pale grey. Is there a way to change this colour?
Thanks in advance,
Addibo
How To Set A Background Colour Of A Listview Row
Hello people, I want to change background colour of specified rows in a list view(in reporting mode). only way available is changing the backgroung colour of all rows but i want to change the background colour of rows what I want, not all. and also is there any way to change the colour of selected rows rather than tradiotional blue colour. Please help me with this thing. THANKS IN ADVANCE!
Listview: Colour Specific Text
Hi,
Already did an long search on the forum, but not getting there. I want to highlight the entire row when it contains a specific word. This could be Radjesh or Klauke (whatever).
There is no need to use an extra Textbox where you can put the searchstring. Everything will be done in the code.... (Select Case....???)
I hope someone can help me out here. I'm loading an Access-file into the listview.
vb Code:
Sub AddListview()On Error GoTo ErrHandler ClearOordijk Set cn = New ADODB.Connection With cn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = "Data Source = " & App.Path & "TestTest.mdb;" & "Persist Security Info = False" .Open End With Set rs = New ADODB.Recordset rs.Open "SELECT * FROM Financiering", cn, adOpenForwardOnly, adLockReadOnly Dim lview As ListItem Do While Not rs.EOF Set lview = Form1.ListView3.ListItems.Add(, , rs.Fields(0).Value & vbNullString, , 0) lview.SubItems(1) = rs.Fields(1).Value & vbNullString lview.SubItems(2) = rs.Fields(2).Value & vbNullString lview.SubItems(3) = rs.Fields(3).Value & vbNullString lview.SubItems(4) = rs.Fields(4).Value & vbNullString lview.SubItems(5) = rs.Fields(5).Value & vbNullString rs.MoveNext Loop rs.Close Set rs = NothingExit SubErrHandler: MsgBox Err.DescriptionEnd Sub
ListView:Change Colour Of Selected Row
Dear All,
I want that when i select a row in listview, its color should change to yellow i.e as soon as i click on a row in listview, its colour should change to my desired color.
Plz guide me.
Regards,
Software Engineer
Set Listview Grid Line Colour?
Does anyone know how i set the grid line colour for the listview?
I've set the background colour of the list view to "button face"
and i can no longer see the gridlines.
cheers
Alternate Colour Lines In Listview With API?
Does anyone know if its possible to create a listview with alternate colour lines using the API or anything? Ive seen controls that do it that look like a listview but they may be some other 3rd party control. Thanks
Changing The Colour Of Text In A Listview
I'm trying to change the colour of the text in a list view on certain entries in the list, like this...
Code:
Set itmX = Me.ListView1.ListItems.Add(, , "AAA")
itmX.SubItems(1) = "BBB"
itmX.ForeColor = vbBlue
This however only changes the colour of AAA to blue, the sub item (BBB) stays black. Is it possible to change BBB also ?
You can't do itmX.SubItems(1).ForeColor = vbBlue
Listview Item's Back Colour
is there any way you can change the backcolor for a specific listview's item (not the whole listview)? i know you can change the forecolor, but i imagine you'd have to use APIs to change the backcolor?
Changing Colour In ListView Control
I am developing an app that links to a database. In the database I am storing time and date details. I load items from the database into a list view control. I want to be able to change the colours of rows depending on the time difference between the date/time in the database and the current time. I am using VB6 can anyone help. Thanks in advance.
Different Colour Text In Listview Control
Hi all
Is there a way i can have different lines in a listview control display a different colour.
I am populating a listview from a recordset and depending on one of the values from teh recordset i want to display that lien in a different colour.
Code:
Private Sub PopulateTradeList(sSearch As String)
Dim clmX As ColumnHeader
Dim itmX As ListItem
Dim indx As Integer
Dim itemToAdd As ListItem
Dim noteSQL As String
Dim ors As ADODB.Recordset
Dim sSql As String
Dim iSpacer As Integer
iSpacer = 10
L3.View = lvwReport
Set clmX = L3.ColumnHeaders.Add(, , "Date", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "Ref", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "B/S", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "Quantity", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "Price", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "Consideration", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "Counterparty", _
L3.Width / 7)
Set clmX = L3.ColumnHeaders.Add(, , "Dealer", _
L3.Width / 7)
ConnectToDatabase "sql02", "test", "test"
sSql = "spGetTradeInfo"
Set ors = CreateObject("adodb.recordset")
ors.Open sSql, goCN, adOpenStatic, adLockOptimistic, _
adCmdText
L3.ListItems.Clear
L3.View = lvwReport
L3.FullRowSelect = True
If (Not ors.EOF) Then
ors.MoveFirst
While Not ors.EOF
Set itemToAdd = L3.ListItems.Add(, , ors.Fields("dealdate"))
itemToAdd.SubItems(1) = ors.Fields("BargainReference")
itemToAdd.SubItems(2) = ors.Fields("Buysell")
itemToAdd.SubItems(3) = ors.Fields("Quantity")
itemToAdd.SubItems(4) = ors.Fields("Price")
itemToAdd.SubItems(5) = ors.Fields("consideration")
itemToAdd.SubItems(6) = ors.Fields("CounterpartyID")
itemToAdd.SubItems(7) = ors.Fields("Dealer")
ors.MoveNext
Wend
End If
End Sub
Lets say if buysell = 1 then the line colur should be vbred else vbblue
Any help would be grately appreciated
Thanks
OMB
Change Colour Of Text In Vb Data Report At Run Time
I want to display a recsordset in vb data report having two fields, name and marks of student.
I want that students getting marks less than 33% show in textbox with red colour.
Please suggest me solution
Listview && Tree View
I have a Tree view and a List view. I have designed something like Windows Explorer. What i want to do is to be able to resize them by using Mouse inbetween the Treeview & Listview.
Please advise.
<?> Listview Icon View
Code:
'question:
'I load my listview and I use 2 different icons
'one for odd numbers, one for even. No Problem
'
I can then view my listview by LargeIcon,SmallIcon,List,Report
No Problem
However, when viewing largeicon I only get one icon
All the rest show me the 2 different icons.
There obviously is a reason...someone what to impart
that bit of knowledge on me.
'load an array with information
Dim myArr(99)
Dim i As Integer
For i = 1 To 99
myArr(i) = CInt(Rnd * 99)
Next i
'then load the array into a listview
Dim x As Variant 'differ between odd and even rows
For i = 1 To 99
'used different images every second line
'image one for odd, image2 for even
x = i / 2
If x Like "*.*" Then
Set sItem = Listview1.ListItems.Add(, , myArr(i), 1, 1)
Else
Set sItem = Listview1.ListItems.Add(, , myArr(i), 1, 2)
End If
'add subitems
sItem.SubItems(1) = "905-444-9455"
sItem.SubItems(2) = "who knows"
Next i
Listview: View An Item On The Top
Hi vbFriends !!!
I have a ListView control (Report mode) and it has a lot of items.
When I search for an item and use EnsureVisible method, it usually happens that the item is shown as the last item in the listview's area.
I would like the item to be shown on the top of the listview's area, so that is much more comfortable for the user to see it.
Any hint that could help me?
Thank you in advance !!!
P.S.: here's an example:
My ListView:
-------------------------------
| 1 |
| 2 |
| 3 |
| 4 |
|found item shown here|
-------------------------------
But:
-------------------------------
| I want it here ! |
| 6 |
| 7 |
| 8 |
| 9 |
-------------------------------
Listview Columns In List View
I am trying to use Listview to import data from an Access table and I only want to use the list view not the list report. The data imports OK and populates the list OK into (in this case with the quantity of data imported) 4 columns.
Trouble is, all the data is truncated and I can find no way of setting the column widths as you can in the normal list box. I do not have any sub-items, just a single list so I do not need to set up any column headers.
Listview Problems With Arrange And View
Hi
I have couple of issues with my listview control.
a) when I set arrange=lvwautoleft, I expect the coloumn headers to appear vertically on the left hand side. That does not happen.
b) When I set view = lvwicon, lvwsmallicon, or lvwlist, I see nothing in the listview control, only the lvwreport works (I see the image and the text in the colomn header). I have set up the image icon and all the setting etc.
regards
Yamin
|