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




Is It Possible To Have An Item Selected In A Listview Without The Highlight?


Hello,

Is there a way to have a whole line selected in a listview or a listbox, but not have the item highlighted? The selected line will have the thin rectangle around it but there wouldn't be any highlight color. Thank you.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Highlight Selected Items In The Listview
I have DT Picker and use listview to display the date and the activities.. When I pickup the date from DTPicker, It list the date and the activities in the listview

For example when I pickup the 27/7/2007 from DTPicker, It list the date 27/7/2007 in the listview. How I can highlight the that date in the listview?



Code:
On Error Resume Next
Dim newDate As Date
Dim newDate1 As Date
rec.MoveFirst
Do Until rec.EOF
If rec("hari") = "" Then


Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")

'Isnull(rec("hari")) ialah test untuk tengo kalau nilai yang dibaca dpd field hari ialah null atau kosong
ElseIf IsNull(rec("hari")) Then



Set lvItem = lvJadual.ListItems.Add(, , "")
lvItem.ListSubItems.Add , , "" & rec("end_date")
lvItem.ListSubItems.Add , , "" & rec("peruntukan")
lvItem.ListSubItems.Add , , "" & rec("aktiviti")
lvItem.ListSubItems.Add , , "" & rec("sasaran")
lvItem.ListSubItems.Add , , "" & rec("jenisinput")
lvItem.ListSubItems.Add , , "" & rec("tindakan")
'lvItem.ListSubItems.Add , , "" & rec("hari")
Else
newDate = DateAdd("d", rec.Fields("hari").Value, DTPicker1.Value)
rec.Fields("start_date").Value = newDate
'rec.Fields("start_date").Value = Format(newDate, "dd/MM/yyyy")
newDate1 = DateAdd("d", rec("peruntukan") - 1, rec("start_date"))
'newDate1 = DateAdd("d", rec("peruntukan") - 1, newDate)

' rec("end_date") = Format(newDate1, "dd/MM/yyyy")
rec.Fields("end_date").Value = newDate1


Set lvItem = lvJadual.ListItems.Add(, , "" & Format(newDate, "dd/MM/yyyy"))
lvItem.ListSubItems.Add , , "" & (Format(newDate1, "dd/MM/yyyy"))
'lvItem.ListSubItems.Add , , "" & rec.Fields("end_date").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("peruntukan").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("aktiviti").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("sasaran").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("jenisinput").Value
lvItem.ListSubItems.Add , , "" & rec.Fields("tindakan").Value



rec.Update
End If
rec.MoveNext
Loop

ListView HighLight Of Selected Items
Dear All,

I am attempting to convert some ListBoxes to more interesting ListView controls. When a ListBox looses focus its selected items (rows) remain highlighted, but I am finding the highlight disappears in the ListView.

Is there a way to maintain highlight of selected items in the ListView control when focus is not on it.

regards Hugh,

Highlight The Listview Item
hi,

I have many items in my list view. And if i click listview, that is in listview mouse down, I have written so that it should show one popup menu(on mouse right click). In that popup menu, many menu items are there. If i click the list view item and right click, pop up menu is coming there. Suppose if i right click near one list view item, i have to highlight that listview item near that popup menu. I think you all understand my problem. Can you please tell me how to solve this?(Just like in windows explorer, if we right click near one filename, that file name gets highlighted)

Thanks,
Kalpana.

ListView - How To Highlight An Item
How do I highlight an item in listview so that the highlight covers the entire row (across all columns)? I have a ListView that has two columns consisting of a filename in column one and the filedate in column two. Selecting an item via:
lstMyList.ListItems(1).Selected = True
only highlights the filename in the first column

How To Highlight 1st Item On External Listview
Just wondering if anyone knows how to highlight the first item on an external listview

Thanks

How To Highlight 1st Item On External Listview?
Hi all could any one tell me how i can highligh the first item on the external listview . I did not many searches but could not find the solution!! So i hope some one help me.Thanks

How To Highlight External Listview 1st Item?
hey does anyone know how to highlight the first item of another program listview

Thanks

How Can I Highlight Item In Listview From A Listbox?
Hello all,

I have been tried for quite a while now to find a way to highlight rows in a listview programmatically without having to click on the listview.

I have a Listbox with order nos.
When I click on one of the numbers, I would like to highlight the corresponding rows in the listview. The first column of the listview contains the order no. The listview has its multiple selection turned on.


I am using this code sample placed in the click event of a listbox but it doesn't work:

Private Sub lstOrderNo_Click()
'look for order no in lvwDetails and highlight corresponding entries
Dim sOrderNo As String
Dim i As Integer
sOrderNo = lstOrderNo.Text
For i = 1 To Me.lvwDetails.ListItems.Count

If Me.lvwDetails.ListItems(i).Text = sOrderNo Then

Me.lvwDetails.ListItems(i).Selected = True
Me.lvwDetails.SelectedItem.Selected = True

End If

Next i
End Sub

Any way to do this?

TIA
Cheers,
Laurent

Keep Listview Selected Item Selected
I've been searching the site this morning and I've seen this question asked numerous times and the answer appears to be no. I thought I'd try again in case there is a fresh set of eyes out there.

I'm working on a preexisting production form and the person that designed it coded a series of combo boxes next to a series of listviews as user controls. When a combo box loses focus the selected item remains the default selected blue color. When the listview loses focus the selected item's color is a light gray.

I would like the listview selected item to remain blue like the combo boxes so the appearance is uniform.

The user community has lived with this for quite some time so I can't justify the time to rework the form. But if someone knows how to keep the selected item blue when the listview loses focus I'll plug it in though.

How To Highlight Another Program Listview Item? [Solved]
First of, I don't if syslistview32 is the same as listview I think it is.

Ok so I want to communicate to the people in a room and all nicks are in the listview. In other for me to communicate and send the messege command I first need to highlight their nick so this is why I need elp with this.

ok this the code I have at the moment


VB Code:
Dim mywindowclass As Long, wtlsplitterwindow As Long, atlb As LongDim syslistview As Longmywindowclass = FindWindow("my window class", Text5)wtlsplitterwindow = FindWindowEx(mywindowclass, 0&, "wtl_splitterwindow", vbNullString)wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)atlb = FindWindowEx(wtlsplitterwindow, 0&, "atl:005047b8", vbNullString)syslistview = FindWindowEx(atlb, 0&, "syslistview32", vbNullString)Call SendMessageByString(syslistview, WM_LBUTTONDOWN, 0&, 0&)SendKeys Text6 + vbCr


The problem with this code specially this I think


VB Code:
SendKeys Text6 + vbCr


Were Text6 is the nick I want to highlight.

Its not real accurate lol sometimes it highlights the items sometimes it doesnt so if anyone has any tips I will appreciated it a lot thanks.

How To Move Listview Item Blue Highlight While Looping Within It?
Hi all.I got this listview and i am looping within it but how to make the listview hightlight move each time i loop within its item. Now i don't see any highlight at all!!
:

2 Code:
Private Sub Command2_Click()
Dim i As Long
For i = 1 To ListView1.ListItems.Count

    txtURL = ListView1.ListItems(i).Text
    'ListView1.SelectedItem(i) = True
    txtURL = ListView1.ListItems(i)
    Dim completeurl As String
    completeurl = "http://localhost/script.php?s=" & txtURL.Text
  ListView1.ListItems(i).SubItems(2) = Inet1.OpenURL(completeurl, icString)

End Sub

Listview Get Currently Selected Item
Is there a way to get the currently selecteditems text for a listview. I'm using vb 2005 and I don't see how to get a listview currently selecteditem. Someone please help me

Thanks for any help
Chris Ara

Listview Selected Item
How can i get the selected item of a listview in another form ???

I have tried with this code:


Code:
Public Function geselecteerdLid() As Integer
Dim iLidID As Integer
Dim oItem As ListViewItem
For Each oItem In lvwLeden.SelectedItems
iLidID = Convert.ToInt32(oItem.Text)
Return iLidID
Next
End Function
and in another form i refer to this with

Code:
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
Dim oForm As New frmLid
MessageBox.Show(oForm.geselecteerdLid)
End Sub
the result of this is always 0, i guess this is because i make an object of the form where my listview is (frmLid)

How To Get Listview Selected Item?
Code:
Private Sub Form_Load()
With lvwSpecies
' Add three columns to the list - one for each data type.
' Note that the data type is set in the column header's
' tag in each case

.ColumnHeaders.Add(, , strHeader(0)).Tag = "STRING"
.ColumnHeaders.Add(, , strHeader(1)).Tag = "STRING"
.ColumnHeaders.Add(, , strHeader(2)).Tag = "String"
' Set the column alignment - has no bearing on the sorts.

.ColumnHeaders(1).Alignment = lvwColumnLeft
.ColumnHeaders(2).Alignment = lvwColumnCenter
.ColumnHeaders(3).Alignment = lvwColumnCenter

.ColumnHeaders(2).Width = 3000
'Populate the list with data in Species files
Dim intCounter As Integer
With .ListItems
For intCounter = LBound(codeTypeArray) To UBound(codeTypeArray)
With .Add(, , codeTypeArray(intCounter).strCode)
.ListSubItems.Add , , codeTypeArray(intCounter).strCodeInfo
.ListSubItems.Add , , str(codeTypeArray(intCounter).intMaxNumber)
End With
Next
End With
End With

End Sub




Private Sub ok_Click()
Dim str As String
str = lvwSpecies.text

'what should go here if i want to get the text of select item? i just
'need the text of first colum.


End Sub
Is there a way to get the item text?
Thanks

Listview - Selected Item
Dear All,

I have an access DB connected to a Treeview and a listview.

Navigation is done by ADO unbound.

How do I connect the highlighted item in the listview with a particular database recordset?


Say for example:

I click on the Next_Record button I would like the Cursor (Highlighted blue area) to move to the next record displayed in the listview corresponding to the correct database record.

Prev_Record button will move the blue highlighted area one position up in the listview and so forth...

Any ideas?

TIA

Listview: Has Any Item Been Selected?
In a listview, how do I know whether any item has been selected? ListView.SelectedItem returns a number even if no line has been clicked on.

ListView Selected Item!
In a WebBrowser project, a ListView acts as the history window. This ListView comes up when the History button is clicked. Each URL is represented in the ListView by the title of that URL (like IE). For e.g. if the user has visited http://www.yahoo.com, it's title i.e. Yahoo! will get listed in the history ListView. Users have been given the option to delete any URL/s from the ListView.

Assume that currently I am viewing http://www.yahoo.com. If the history ListView is now invoked, Yahoo! will be highlighted in the ListView (since I am presently viewing http://www.yahoo.com). Suppose I delete any other URL in the ListView. Under such circumstances, the very first URL gets highlighted in the ListView but I want Yahoo! to remain highlighted in the ListView after that URL is deleted from. How do I accomplish this?

ListView Selected Item!
In a WebBrowser project, I am using a ListView which acts as a "history" window (like how IE opens a side-window when the history icon is clicked on the toolbar). As is evident, the ListView lists all the URLs that a user has visited.

When I click an item in the ListView, I want that after the appropriate web page gets downloaded completely, the item selected should remain highlighted which is why I have set the ListView's HideSelection property to False.

Assume that I click the 5th item in the ListView. When I do so, the selected URL gets highlighted & the browser navigates to the corresponding URL but after the web page gets downloaded completely, the first item in the ListView gets highlighted but I want the item that was clicked by the user should remain highlighted after the web page loads completely. In other words, I want the 5th item in the ListView to remain highlighted after the web page loads (since I had clicked the 5th item in the ListView). How do I implement this?

Whenever the ListView loads, the first item in the ListView is seen highlighted (as HideSelection is set to False) but I don't want the 1st item (or for that matter, any of the items) in the ListView to get highlighted whenever the ListView loads i.e. none of the items should be highlighted whenever the ListView loads. How do I do this?

Listview Selected Item
ok my app has a listview which has a check box in it. I have setup so that when someone clicks on an item, the selected item becomes checked. how do i set for when the item becomes checked, the item becomes selected???

hope i explained that correctly...


please help me code

Listview Selected Item
I have a listview on a form...
The item which is selected should be selected even if the form looses focus or unloads.
Next time when form gets focus that previously seleted item should be selected...........

ListView Selected Item
Have any easy question about ListViews. When my form opens up the first item in my listview is selected. How would I keep this from happening? Do I need to loop through all items in the list view and set the selected property to false or is there an eaiser way. I would like to keep my load time down on my form.

Thanks ahead of time.

Listview Selected Item
Hi,

I have a listview populated with a few dozen records from my database.
The listview has 10 column's. I try to make a change to for example the 3th record the 5th column. Althougt I select the 5th column always the first column of the 3th record is updatable.
How can I accomplish that I can select any cell of the listview to make an adjustment with I can send to my database.

I'm in great need for a solution, but can't (after a whole try and search) find it, plaese has someone a helping hand

With regard, thanx in advance

Charles

Using The Item Selected In A Listview
private sub cmdClick_click()



If Not ListView1.SelectedItem Is Nothing Then
frmEditor.txtName.text=listview1.selecteditem.text
frmEditor.txtRecNumber.text=listview1.selectedItem.subitem _(1).text
end if


end sub

would this work for getting the items over to the editor page?
how can i make it so that when they double click on the row, it will go to the editor page?

Private Sub lvwLogBook_BeforeLabelEdit(Cancel As Integer)

End Sub
i dont think this is the right sub to use is it?

ListView Selected Item
I want to know if there is a way to select an item in the
listview control and only have a portion of the item selected. For example, I want the first column of the selected item NOT to be highlighted but the rest of the columns to be highlighted. It works that way in the Outlook Express. Thanks.

Selected Item In Listview
i am having a problem with selecting an item in a listview
any ideas ?

Private Sub Image4_Click()
Dim printdrwval As Variant
Dim vpcgetprintable As Variant
Dim testfileprintable As String
Dim zfile As String
Dim sprintername As String
Dim sprinterport As String
Dim selprintdraw As String

If msprinterdevicename = "" Then
  MsgBox "Select Printer", vbCritical
Else
          Dim x As Integer
          For x = 0 To ListView1.ListItems.Count - 1
          
          If ListView1.SelectedItem.SubItems(x) = True Then ' I think this is wrong
selprintdraw = ListView1.SelectedItem.SubItems(x)
MsgBox selprintdraw, vbExclamation

'sprintername = (" XES Synergix 8825")
'sprinterport = (" \PARFSXerox 8825")

'zfile = Dir("c:pdfinfo.txt")
'If zfile = ("c:pdfinfo.txt") Then Kill ("c:pdfinfo.txt")

'vpcgetprintable = Shell("C:productcentercodePCgetviewableDebugPCgetviewable.exe " + Text1.Text, 1)
testfileprintable = Dir("c:pdfinfo.txt")
While testfileprintable = ""
    testfileprintable = Dir("c:pdfinfo.txt")
Wend
Open "c:pdfinfo.txt" For Input As 1
While Not EOF(1)
Line Input #1, printabledrawing
Debug.Print printabledrawing
Wend
Close 1
If printabledrawing = "error" Then
  MsgBox "Get Copy Not Successful", vbExclamation
  Kill ("c:pdfinfo.txt")
  Else
  drawtoprint = ("c: est" + printabledrawing)
  'If msprinterdevicename = "" Then
  'MsgBox "Select printer", vbExclamation
  
  'printdrwval = Shell(msacrobatpath & " /p" & " " & drawtoprint, 1)
  printdrwval = Shell(msacrobatpath & " /t " & drawtoprint & " " & Chr(34) & msprinterdevicename & Chr(34) & " " & Chr(34) & msprinterdevicename & Chr(34) & " " & Chr(34) & msprinterdrivername & Chr(34), 1)
  'Kill ("c:pdfinfo.txt")
  'Exit Sub
End If

 End If

         Next x
End If
End Sub

Always First Item Selected (listview)
Hi
can anyone helps me??

there is always one item , the first, selected in the listview, although i dont want it!!

thanks

delphin

LISTVIEW And Selected ITEM
I want my Selected Item in my listview to still have its highlight even if it lost its focus. Anyone knows how to do that? it would be a great help.

Without API is a better solution.... but if there is no other solution, API would be considered

Listview Always One Item Selected
In a listview when the multiselect property is set to true,we can select multiple listitems.We can get the selected item count in two ways,either by running a loop and checking whether each item is selected or not, or by using an api call.But in both the ways the count of selected item is atleast one even if none of the items are selected. How do i avoid this ?
Regards
Sravanthi

HighLight List Box Selected List Item With User Defined Color
Hi Friends,

I need a help from u all. My problem is to change the Backcolor of the selected listitem of a listbox.

Let me explain detail. Normally in a listbox if we selected the list, the list item will be highlited with blue backgroud (ie. the selected item color settings of the system). Now I need to hightlight the selected list in the list box with my own color say red, green or something else.

Would anyone help me.

V.P. Vijayavel

How To Show The Selected Item In A Listview?
I want to be able to show the selected item in a listview. I'll try to explain by an example.

Visible items:

Item 1
Item 2
Item 3
Item 4

Invisible items:

Item 5
Item 6
Item 7
Item 8

Now when I select Item 8 by the use of source code like this:

listview.listitems(8).selected = true

I want to scroll the listview so that the item becomes visible. So how do I scroll the listview to the selecteditem with source?

Checking If An Item Was Selected In ListView
Hi

I've got a ListView and i need to check whether an item has been selected or not... this is the last thing i've tried

Code:
If Not ListView1.SelectedItem Is Nothing Then
'Do something with the selected item
Else
MsgBox "No item selected"
End if
But its not working, when i click on the delete button it deletes the last item that was entered even when not selected! and if the list is empty it displays the msg box!

Any ideas
HannaH

Listview Move Selected Item Up Or Down
hi ,...

i would like to know how can i move a selected item in the listview up or down ?!

i tried :


Code:
listview1.selecteditem.index=listview1.selecteditem.index-1
or
listview1.selecteditem.index =listview1.selecteditem.index +1

but this is not working !!
anyone can help me please !?

thanks in advance ..

Check If ListView Item Is Selected
Hello!

Is it possible to check if a ListView item is selected without using a loop?

Regards,
Sebastian Mares

How To Scroll The ListView To The Selected Item?
I have a textbox. When the user key characters into the textbox, it will try to match the text in the textbox with the items in the listbox. How to make it scroll until the item is in view??

Can anybody help me out??

Jumping To Selected Listview Item
Hi,
im running a search through a listview and when an item is found it is selected and the search stops so the user can see the found item.

My question is how can i jump to the slected item in the listview.

My search code....

Code:
If InStr(1, Form1.LV1.ListItems(posAss).Text, sstring) Then
Form1.LV1.ListItems(posAss).Selected = True
findIt.Caption = "Find next"
foundSome = True
posAss = posAss + 1
Form1.LV1.SetFocus
Exit Sub
End If

Thanks for any help,
-Dave

ListView Syntax For No Selected Item
This should be super easy. How do I check a listview to see if there are no selected items?

I have a search form that loads up a listview with search results. The user can select an item from the list, and then click a command button to take them to the form for editing the selection.

I'm trying to add protection against the edit form trying to open without a valid selection in the list box.

Private Sub cmdEditProduct_Click()
If (there isn't anything selected in the list box) Then
MsgBox "hey select something to edit - geez!"
Else
'open the edit form blah
End If
End Sub

Can't seem to find the syntax for the 'list box has nothing selected'
Any help is much appreciated.

ListView - Selected Item ToolTipText???
Does anyone know how you can get a tooltip text to appear when you hover over text of a Listview Subitem and the text isn't fully visiable?

Regards

[img]images/icons/smile.gif[/img]

AbsolutePosition From Selected Item In A ListView
Hi all,

Is there any way to get the AbsolutePosition of a selected record
in a ListView Control?

That is, the AbsolutePosition of the record in the underlying Recordset.

Thanks

GT

ListView: How To Check If There Is An Item Selected?
Any ideas? I have tried using a thousand different codes and i can't get it to work :/
I have tried using the property Listview1.SelectedItem.Selected and i get a runtime error :S

Any ideas?

Listview Bold Selected Item
why this code doesnt work? i use Microsoft Windows Common Controls 5.0 (SP2) entire my project..

kindly help me fixed or solve ths please?


Code:
ListView1.Listitems(1).Bold = True

Item Removed From A Listview When There Is None Selected.. Why?
I want to know why if I click cmdRemove command button it will remove the unselected item from a listview. I wonder if a listview automatically select an item as its default selection until I select one from the list. If I am right, then how can I make a listview not automatically select the item?

How To Get Selected Listview Item Using Sendmassage ?
Hi all i already selected a listview item . Is there away to get that item using send massage ?


I use this code to select the listview item:


VB Code:
lItemPos = 0& ' first item            SendMessage hWnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM

Listview Selected Item...(Screenshot)
I have a listview..

the first 7 columns are icons, the next 3 are words
(in report view)

when I select an item (Full row select) the columns with the icons look terrible, then when I switch it leaves little dots from the selection

the BG color is black...

is there a way to just have say column 8 show the selection? or a better way to show a full row select?


Screenshot attached...

ListView Selected Item Color
I'd like to set a forecolor for the selecteditem and remove after another item is selected. Any ideas how I can do this w/o iterating through all the items and setting their colors to default besides selected Item?

Check If Item In Listview Is Selected
I have searched these forums, but have not found a answer that works.

Here is my problem:
When i item in the listview is not selected, then it needs to exit sub

Listview - How To Check Whether Any Item Selected
I am using the listview control. I would like to know that how do I check whether a user has selected any item in the list or not ?

How Do You Remove A Selected Item From A Listview?
I thought it was something like ,














VB Code:
ListView1.ListItems.Remove (ListView1.SelectedItem.Text

Delete Selected Item In Listview ?
I thought it would be something like,

Me.ListView1.SelectedItem.Clear , but nope ?

How Do I Default A Selected Item In A Listview
I thought that once you have populated a ListView control, you could default the selected entry with the following code, which would automatically select the first one :


VB Code:
Set lvwItems.SelectedItem = lvwItems.ListItems(1)


but my program seems to ignore this !?!?!?!

Any ideas ?

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