Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Display Contents Of Listview In Different Colors.


How can we display the contents of listview in different color depending on some condition. I have set Listview1.View = lvwReport

i want something like :

dim litem as listitem

While Not rsFieldName.EOF
'Check for some condition
If rsFieldName.Fields("field") = 2 Then
??????
'SET FONT COLOR = RED
Else
??????
'SET FONT COLOR = BLACK
End If
Set litem = Listview1.ListItems.Add(, , rsFieldName.Fields("Caption"))
rsFieldName.MoveNext
Wend

Thanks in advance.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Make Listview Display Items In Alternate Colors
hi,

is it possible to make listview display items in alternate colors?

regards.

ann

Display Directory Contents In A Listview
Im having problem using Listview control...in my application, i want to display all files in a particular directory...let say i only want to display a directory Dir1.Path = "C:ISISArchive"...and then i want my listview to view all files in this directory...

can someone show me a code for this???
ur help would be much appreciated!!!

Display Recycle Bin True Contents In Listview
Over the past couple of days I have been working on a mini-file explorer. I have it listing the drives,directorys in a treeview and showing the lists in a list view.

But I have not figured out how to display the true contents of the recycle bin. I can display the individual recycle folders on the various drives but I am looking to display them as one in the listview as it does in windows explorer. Does any one know how to do this or has some sample code to show how to display the RB??

TIA Very Much..

P.S. I have looked on all the usual sites but have found no code to do this.

How To Keep Flexgrid Row Colors Depending On Cell Contents
hey peeps,

i have the following code to scan a flexgrid, and depending if the contents of a cell match a scannedcode, the row colour changes from red to green.

the code works (sort of), but everytime a new scannedcode is searched and found, the green row simply moves... I need the flexgrid rows to STAY green as more scannecodes are found in the table.

grrrr.... I do understand _why_ the row color keeps moving, but i can't understand how to work around it!

please help!

Private Sub codefound(scannedcode, numtotallines)
Picresult.Print "FOUND"
Dim lrow As Long, lcol As Long
Dim lcolor As Long

'stockview.Redraw = False

For lrow = stockview.FixedRows To numtotallines
stockview.Row = lrow
If stockview.TextMatrix(lrow, 1) = scannedcode Then
lcolor = vbGreen
Rem Else: if stockview.backcolor = vbRed then
Else: lcolor = vbRed

End If

For lcol = 0 To 1
stockview.Col = lcol
stockview.CellBackColor = lcolor
Next lcol
Next lrow

'stockview.Redraw = True
End Sub

DISPLAY COLORS
COLOR DESPLAY
Posted By filipematsimb... On Thursday, June 24, 2004 at 9:40 AM
Hi all,

have got here, 3 shapes to locate them,using VB for excel2000.

I want to continue but I am a bit stuck,I would like to continue using the following but i would like to change the CODES so that the program can be able to :

1, to display the color flashing when find the shape for 2 seconds and stops.
2, to use the print the selected shapes
3, to link the Help booton to a file, so that when you press help u can access it

My code is:
*********************

Sub CommandButton1_Click()
UserForm1.Hide
End Sub

Private Sub Label1_Click()

End Sub

Private Sub Label2_Click()

End Sub



Private Sub TextBox2_Change()
'TxtBox2.ForeColor = vbRed
'richTextBox2.selitalic = Not richextse.seltalic

End Sub

Private Sub TextBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

End Sub

Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)

End Sub

Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
TextBox2.Enabled = False
End Sub

Sub UserForm_Activate()
UserForm1.Label1.Caption = "Component " & UCase(Range("CompName").Value) & " Selected"
shapescount = Sheet1.Shapes.Count

For shapeno = 1 To shapescount
If Right(Sheet1.Shapes(shapeno).Name, Len(Sheet1.Shapes(shapeno).Name) - 5) = UCase(Range("CompName").Value) Then
Sheet1.Shapes(shapeno).Select
Selection.ShapeRange.Fill.Solid

UserForm1.TextBox2.Value = WorksheetFunction.VLookup(Range("CompName").Value, Sheet2.Range("Part_List"), 2, False)


ElseIf Range("CompName") = "" Then
'UserForm1.Label1 = " No Component Selected"
'UserForm1.TextBox2 = "Not selected"
'intRes = MsgBox("You should select a Component Name.", vbExclamation, "ALERT!!!")
UserForm1.Hide
'sheet1.Range("CompName) = ""
' Range("CompName").SetFocus
'Exit Sub



MsgBox ("Auditorium lacks chairs!")
Exit Sub



ElseIf Len(Range("CompName")) > 5 Then
UserForm1.Label1 = " Type 5 Characters Maxim "
UserForm1.TextBox2 = "Not Selected"


ElseIf Left(Sheet1.Shapes(shapeno).Name, 5) <> "COMP_" Then

UserForm1.Label1.Caption = "Component " & UCase(Range("CompName").Value) & " Selected"
UserForm1.TextBox2 = "Does Not Exist"


End If

Next shapeno
Range("CompName").Select



End Sub
****************************
Sub Flash()
Dim lngPause As Long
Dim lngTotalDuration As Long
Dim lblnColour1 As Boolean

'Choose your colours that are to be flashed between
Const COLOUR_1 = 10
Const COLOUR_2 = 0
Const DURATION = 50000000 'Change to suit your processor speed and requirements.
Const PAUSE = 1000000 ' Again change to suit requirements.

ActiveSheet.Shapes("Rectangle 1").Select
lngPause = 0
For lngTotalDuration = 1 To DURATION
lngPause = lngPause + 1
If lngPause > PAUSE Then
lblnColour1 = Not lblnColour1
If lblnColour1 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = COLOUR_1
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = COLOUR_2
End If
DoEvents 'Without this the shape will not change colour until the code finishes!!
lngPause = 1
End If
Next lngTotalDuration
End Sub



some can help me out.
FILIPE

Display With 256 Colors
Is it possible to get a proper display of 24bit images in 256 a color enviroment?

How To Display Text In MsFlexgrid In Two Colors
Hai,

  I am displaying a calendar in MsFlexgrid Control, i check the database and if the record is for a date - then i will place some information in the Cell {Date Column in MsFlexgrid} , but the space is not enough, i put the request here and tried whether is there any way to provide the ScrollBar inside a Cell in MsFlexgrid. I think its not possible. I get the replies to increase the height of the row, but increasing some of the row height will not look good in a Calendar. The user also use to take print out of it.



For example i need as below - Is it possible to do it in a single Cell in MsFlexgrid.

Quote:Start Date: 0/22/2006
Eqp Name: Sulphur TR3

Click Here For Detail

Thankyou,
Chock.

Looping Through A Listview And Adding Contents From One Listview To Another
i have my code for my old listbox but i need to convert it to the listview

any help?


Code:
For i = 0 To frmmain.lstQY_IT_DES.ListCount
lstprint.AddItem frmmain.lstQY_IT_DES.List(i)
Next i

Read From File Display Text In All Diff Colors..
hi...i need to display the test in different colors in a RTF..
can u pls help???
lets say i have this text "Beautifull World"
now i want to display this text in such a way so that
"Beau" is in red color
"tifu" is in green
"l World" is in blu color..
onto a rich edit text box...
can someone plese help me???
tks a lot...

To Display The Contents
hi,
The following codes are for appending some text to a text file
It works fine but the problem is when I want to click command2 button to display what I have already written,it doubles the contents which are already there..
How can I fix the problem..?
thanks

VB Code:
Private Sub Command1_Click()Dim gir As StringOpen "C:one.txt" For Append As #1gir = InputBox("my text")Print #1, girClose #1End Sub Private Sub Command2_Click()Dim met As StringOpen "c:one.txt" For Input As #1Do While EOF(1) = FalseInput #1, metLabel1.Caption = metText1.Text = Text1.Text & metLoopClose #1End Sub

Display Contents
someone plz tell me how to Display the contents of a folder in the DirListBox that user clicks on...in my listview next to it

more explanation: Ihave a DirListBox and a ListView....iwant what folder clicked in dirlistbox to be displayed in the listview... lol

iam lil confused wit how ?

Listview Colors
i dont have a problem making a line red in my listview, the only problem is that it only makes the first column red. how do i make the entire line (all the column's) red....


(understand this is per line, i dont want the entire thing red)

heres what i have

Set itm = ListView1.ListItems.Add(, , rs2("date"))
itm.SubItems(1) = rs2("time")
itm.SubItems(2) = rs2("name")
If rs2("status") = 0 Then itm.ForeColor = vbRed

Colors In Listview
Hello to all,

I need a routine where I can passed any listview control.

When I clicked on a row in the listview, I need to color the whole row (VBGreen) and when I click another I want to set it back to normal but at the same time highlight the next one to VBGREEN.

How can I do that

thanks

ListView Colors...
When using the ListView as a report and setting the GridLines property to True, Is it possible to color an specific cell of it?

ListView Row Colors??
Hello,

Is there any way that I can highlight a row or row(s) in a report style listview? I have some data that I need to draw attention to over other and it needs to be readily visible. Any help would be greatly appriciated!!!





VB6SP4

Listview Row Colors
I noticed on the C++ sister site that there are some examples on how to set seperate row colors in a listview control. Is there anyway to do this in VB??? It would be a shame to recode my app in VC just so i can get row colors.


cheers, Nick.

Display Contents Of A .nfo In A Text Box?
Hello all. Being very new to VB, I was wondering how I would load the textual contents of a .nfo (or a .txt for that purpose, .nfo is just popular 'cuz the icon looks cool) into a text box on a form? I want it to be unmodifiable. In fact, it is basically going to be one of those legal disclaimer/license agreement things that you see when you install anything: a plain text box that says you can't sue them if this program causes you to have seizures.

I would appreciate any help.

Display Contents Of An HTM File
How can we modify the following code so as to display the content of a html file using Rich Text file?



Code:
Private Sub Command1_Click()
Dim strListItem As String

Open "c: ah12.htm" For Input As #1
While Not EOF(1)
Line Input #1, strListItems
list1.additem
Wend
Close #1
End Sub
Edit by loquin: gencoglu27: I split this post off the earlier thread, as it had nothing to do with the prior topic. Separate follow up topics should be posted in their own thread.

Display Contents Of An Xml File
anyone know how I can display an xml doc after updating. within a vb app

cheers
R

ListView ColumnHeader Colors
I'm working on a form using Listview, and have managed to figure out quite a bit so far in getting it functioning. Now I would like to add to the look of the form. I cannot find any property that will change color of the column header. Could you assist me in how to do this, or an on-line manual that would show this type of information. Thanks.

ListView, Colors And API-constants...
Suppose we have ListView control with View = Report and HideSelection = False. When we select some row in the listview, we can see this row is "filled" with color, which is dark-blue if we work with "Standard" Windows color scheme; API-constant for this color is COLOR_HIGHLIGHT - this is clear. When listview loses focus, the previously selected row remains "filled" - but with another color: in the "Standard" Windows color scheme this color looks like light gray, but what is the proper API-constant for this color?! I looked in API Viewer 2004 among constants beginning with "COLOR_", but found nothing.

Two VB6 color constants seem to match: "Button Light Shadow" and "Inactive Border". But it's not really so - when setting the computer to any of the "contrast" Windows schemes, we can see that selected row in our "focusless" listview is filled with different color; I made a special small demo-project for this. So, generally speaking, we can't use these two VB6 color constants as substitutions for the missing "row-highlight-when-not-in-focus". It seems that there should be a special, separate API-constant for this mysterious color, but where can I find it?!

Alternate Colors In ListView
is it posible to have an alternate row colors in listview? How?

ListView Column Colors
is there any way to change the colors of the column headers in a listview?

Colors And Listview Enabled
Why am I getting a grey box for each of the items in a listview when I do a enabled=false?

It's not setting the text color, but the item backcolor?

clueless in kalispell

Display File Contents On A VB6 Form
Hi,
How can I make a form with a powerpoint show embeded in it, like a picture.
I do not want it to open powerpoint or run the slide show in full screen. Is this possible.


Regards, Matt

Display Form Contents On Desktop?
Hi all, i was wondering if it is possible for me to display a textbox on the top right of the desktop so i can put reminders in there, because i am a programmer in other languages such as c++ i would find it usefull just to put notes onto a textbox in my desktop instead of opening up notepad all the time with my over crowded taskbar.

Thanks in advance.

Take Contents Of A File And Display On A Richtextbox
how come when i get the contents from a .doc file to be displayed in a richtextbox i get a garbage.. please help.. tnx!

Display Contents Of A Speadsheet In Cells
Hi,

I have created a userform that when you click the drop down menu(combo box) and select a number it will autofill the rest of the data in the text boxes in the same userform. The code used is shown here


Code:
Private Sub cbJobNo_Change()
Dim rFoundSource As Range

Dim strText As String
Dim tBox As Control
If cbJobNo.ListIndex > -1 Then
strText = cbJobNo.Text

Set rFoundSource = Range(cbJobNo.RowSource).Find(what:=strText, _
after:=Range(cbJobNo.RowSource).Cells(1, 1), _
LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, _
searchdirection:=xlNext, MatchCase:=True)

For Each tBox In Me.Controls
If IsNumeric(tBox.Tag) Then
tBox.Text = rFoundSource.Offset(0, tBox.Tag)
End If
Next tBox
End If


Sheets("applications issued").Select
Sheets("Applications Issued").Range("a4") = _
PaymentApplication.cbJobNo.Value
End SubPrivate Sub cbJobNo_Change()
Dim rFoundSource As Range

Dim strText As String
Dim tBox As Control
If cbJobNo.ListIndex > -1 Then
strText = cbJobNo.Text

Set rFoundSource = Range(cbJobNo.RowSource).Find(what:=strText, _
after:=Range(cbJobNo.RowSource).Cells(1, 1), _
LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, _
searchdirection:=xlNext, MatchCase:=True)

For Each tBox In Me.Controls
If IsNumeric(tBox.Tag) Then
tBox.Text = rFoundSource.Offset(0, tBox.Tag)
End If
Next tBox
End If


Sheets("applications issued").Select
Sheets("Applications Issued").Range("a4") = _
PaymentApplication.cbJobNo.Value
End Sub


This works well but i want to have another drop down list on the same user form that reads data from a different work sheet. I thought this would be easy but as you can see from the code, there is no where in it that says what sheet it is working with. Any ideas how i can get this working? I have tried using sheets("worksheet1").select but this does not work. The only code that i have changed is the name of combo box.

User form is attached

Display Contents Of Form Keep Getting Erased
Hi! I'm having a problem with the contents of my forms data getting erased.

My application is grabbing data from a USB 2.0 digital camera. I call a camera function called VbStartVideo which has a parameter that points to the frame buffer that receives the data.

In my case I'm grabbing data from the camera directly to a form. VbStartVideo frmd.hwnd

Everything works fine when the camera is constantly outputting data. The problem happens when I stop the camera. I can see the last image however when I pass anything on top of the form or minimize the form or pass another application over it (such as notepad) I lose all the data inside the form. Basically I just see the forms background. See attached image.

My goal is to be able to place things on top of the form that is not grabbing and not overwrite the last image.

Thanks!

Display Contents Page Of Help.hlp File ?
hello

i've a help.hlp file.
in the project properties i've set the help file and set Project Help Context ID=12

in click of Help Contents from menu 've written -
dlgHelp=cdlHelpKey
dlgHelp.ShowHelp

dlgHelp is the name of the Dialog Box.

but when i click on Help Contents, it opens the index page of the help box.

moreover, when i made the setup of the project and run the .exe on some other system, it simply shows the index, with the Contents tab missing from the help box.


pls help ....
i need to display the Contents page when i click on Help Contents
& the Index page when i click on Help Index.

thanks in advance
shruti !

How Do I Can Select A Row In A DBGrid1 And Display Its Contents?
How can I select a row in a DBGrid1 and display its content in another Form? The DBGrid1 is bound to a data control which this is bound to a table in a database.

I need to select just one row of my recordset visible in a DBGrid1, then after select this row I need to open a form and display all the fields of my selected row on another form.

thank you in advence

How Do I Get The Contents Of A Text File To Display As Is
I need to show the user the contents of a text file. Originally I tried reading it in and then writing the data to a text box but the original spacing between columns was changed. Now I am creating an OLE object which displays the file in the form of a notepad to the user who can then double click it to see the contents in notepad.exe.

I want to bypass all that and just have the contents of the file displayed with original formatting, without the user seeing a notepad to double click.

How do I do this?

Display Contents Of Folder In A Listbox
Hi,

I seemed to have forgotten how to do this, but...How do I display the contents of a folder in a listbox? I know I can use the FileSystemObject, but surely there's some kind of API I can use as well?

Can We Change The Colors Of Each Field In A Listview?
Hi,

Can we change the colors of each field in a listview?

Seema_S

ListView: Change Colors Of A Subitem
With the ListView control in REPORT view, at RUNTIME:
1) How can I change the backcolor / forecolor of INDIVIDUAL subitems?

2) How can I find which SUBITEM has been clicked on?
(Click only give the item index, mouse_down only gives the x co-orordinate which will vary depending on the columnheader widths).

OR are these things simpler to do using a FlexGrid control? (havn't used it)

Display Array Contents In Text Window
I need help displaying the results from one of my scripts. Currently, I write my output to a growing array and then use the msgbox function to display the whole thing at the end.

I have 2 problems with this.

#1 - I sometimes run out of room in the msgbox when my output gets too big

#2 - The user has to dismiss the msgbox before he can go back into the spreadsheet.

I'd like to be able to display the data in some kind of text box window that the user doesn't have to dismiss right away to start using the spreadsheet again.

I've thought of writing the results to a text file and then launching notepad or something to view the data, but there has to be an easier way to do it in visual basic in excel.

Any help?

Thanks

-Jeff

Display Contents Of A Counter In A Textbox/label ??
Hi guys,

This is probably quite a basic question. I am using Visual Basic 6.

I have a counter.. CounterA.

How do I display the content of this counter in a textbox or label or something of that sort?

I tried this: lblA.AddItem (CounterA)

But it returned this error: Run-time Error "438":
Object doesn't support this property or method.

Please help

ListBox Display Directory Contents Matching *.mp3*
I have a DirListBox and a ListBox. I want so that whenever the button "updateList" is pressed, the ListBox displays the files in the directory the DirListBox has selected that match the extension .mp3 . For use in a media player type program thanks

Code To Display Contents Of A Table From A Database
Hie...

I am looking for a code to perform the following:

1. Created a database with the table IT_COMPANIES having the fields compid, compname, dtestablished etc. The table has 100 records.

2. Created a form IT HISTORY with a button btnmoredetails, on clicking the button, the table IT_COMPANIES should be opened, but displaying the first 10 records. Now in this case the table should have the next and previous buttons to navigate to the next or last 10 records.

Please help me with a code that will perform the tasks in step two.

How To Automatically Display Contents Of Excel File
hi experts,

i created a module that dumps everything in an excel file. how can i automatically display the contents of that file?

would appreciate any thoughts/ideas on this.

thanks and regards.

ann

Display Contents/open Combo Box ~ Resolved
A long long time ago in a galaxy far away a programmer used send keys in Access. Now that lazy programmer (not me I promise) has gotten into trouble since Vista has come along. Long story. To surmise, I need to get rid of send keys in the Access app.

Now to the one that I haven't been able to find different code for. When we open a form, at times we place focus on a certain combo box and send Ctrl + F4 to it to open the combo box and display the contents. I don't want to replace these with list boxes for various reasons. Is there a property setting or command I can use to display the contents without using send keys?

~Elizabeth~

"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila "


Edited by - Aurian on 8/29/2007 6:08:08 AM

VB Can't Display DataGrid Contents In Office 2000 Environment
Hi all,
I wrote a program using VB. The program uses ADODC and DataGrid with Access for the database. It also creates Excel files from the DataGrid contents.

When I ran it on Office XP and Office 2003 environment, it works well, no problem. But when I try it on Office 2000 environment, the DataGrid WON'T show anything, although the database is filled and the Excel files are created (no problem with the function to store to the DB and create Excel files).

FYI : Everytime I run the EXE file in Office 2000 env, it always asks for Office 2000 CD. But after I put the CD and copy files from it, no change, nothing happens....

Can anyone tell me how to solve it? Maybe there's a special DLL or OCX I have to include so the DataGrid can show the contents?

Thanks a lot

VB Can't Display DataGrid Contents In Office 2000 Environment
Hi all,
I wrote a program using VB. The program uses ADODC and DataGrid with Access for the database. It also creates Excel files from the DataGrid contents.

When I ran it on Office XP and Office 2003 environment, it works well, no problem. But when I try it on Office 2000 environment, the DataGrid WON'T show anything, although the database is filled and the Excel files are created (no problem with the function to store to the DB and create Excel files).

FYI : Everytime I run the EXE file in Office 2000 env, it always asks for Office 2000 CD. But after I put the CD and copy files from it, no change, nothing happens....

Can anyone tell me how to solve it? Maybe there's a special DLL or OCX I have to include so the DataGrid can show the contents?

Thanks a lot

File List Box...Is There Way To Display The Contents Of Two Folders In A Filelistbox?
Is there a way to display the contents of two folders in filelistbox, instead of only displaying the contents of one folder. I would use two directory listboxes and then the if the paths of the both of those could display in the same filelistbox that would be what I want.
Thanks!
Eric

Need Program To Display .txt File Contents As A Scrolling Window
It's been 15 years since I did any Basic programming, so
I was wondering if I could get some help.

I want to display the contents of a .txt file in real-time
as the file is updated. I don't want to just copy the entire
contents, but only update the scrolling window with newly
added info which I can scroll back to see previous updates.

Anybody out there willing to take on this project?

Thanks

Big Fred

P.S. OS is Windows 2000

Creating Form In VB To Display Contents Of An SQL Database Table
Hi,
I am a biginar, I dont't know much about VB. I have a MSSQL server "Test" and upsized a access database to this SQL server. Previously i was accessing the database from the access form, now the database is on SQL server and don't know how to access it. I heard that VB can help me to create a form using which I can access SQL databases. My databse name is "temp" with a table "test"
Can some budy help me to create a VB form so that I can open the databse "temp" from server "test" and display the contents of table "test"
Thank you.
Arun.

Best Control To Use To Display Contents Of An ASCII Text Appending File?
Hi,

I have a chemical analyser grinding out results for several process streams. As part of saving historical data, I format the results from each analysis into an ASCII string with timestamp, and then append the string to the appropriate sample file.

What is the easiest way to allow the user to scroll through such files?

For event logging, I have set up a series of text lables (15 say) and the used a vertical scroll bar to dispaly 15 of the last 200 events. The events are stored in a circular buffer, which contains the last 200 events. This works well, as I can color each line to indicate the type of event (yellow on red for error, white on green for result, white on blue for standard..). But the coding is fairly complex and am looking for a simple display of analytical results for a given sample stream.

In the case of the anlysis results, the data is appended, so the file just keeps growing. Presumably, monthly files will be separated and stored.

Need A Control To Display Text File Contents In Editable Form
Hi all,

     I need to display the contents of a .txt file on interface in an editable formate.
                Also want to store those edited contents in a .txt file.
                Could some one suggest me a suitable control for this purpose.

                Thanks

sachin

 

How To Have A Textbox Accept Full Pathname Entered && Display Contents In Picturebox
Just learned how to create a textfile and have VB read it and display one OR all lines into a picture box.

My inquiry is on another method:

(a) I also have a textbox. Want to set it to accept the input of full textfile pathname, then the textfile is read and contents displayed in the picture box.

How would I do this? I was thinking to use an IF statement?? Really not sure.

I've attached my program files as that is only part I have not coded. (small beginner program)

Thank you for any help.
~ Juanita

Copyright © 2005-08 www.BigResource.com, All rights reserved