×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Find exact valute in listview and return the row index

Find exact valute in listview and return the row index

Find exact valute in listview and return the row index

(OP)
I Just have myvar=test, how to find in column 12, and return the index row?

RE: Find exact valute in listview and return the row index

...and what have you tried?

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson

RE: Find exact valute in listview and return the row index

(OP)
Olny a simple loop an column 12.
But a few time ago i remember the use of find statement

RE: Find exact valute in listview and return the row index

Listview has a Finditem method - but this does not allow you to search within a particular subitem column

Here's the Hel File entry (as I have previously advised - and provided a link to - the help file is really useful; not using it once again suggests that you think our time is less valuable than yours ...)

CODE --> entry

FindItem Method (ListView Control)
      
Finds and returns a reference to a ListItem object in a ListView control.

Syntax

object.FindItem (string, value, index, match)

The FindItem method syntax has these parts:

Part            Description 
object          Required. An object expression that evaluates to a ListView control. 
string          Required. A string expression indicating the ListItem object to be found. 
value           Optional. An integer or constant specifying whether the string will be matched to the ListItem object's Text, Subitems, or Tag property, as described in Settings. 
index           Optional. An integer or string that uniquely identifies a member of an object collection and specifies the location from which to begin the search. The integer is the value of the Index property; the string is the value of the Key property. If no index is specified, the default is 1. 
match           Optional. An integer or constant specifying that a match will occur if the item's Text property is the same as the string, as described in Settings. 

Settings

The settings for value are:

Constant   Value   Description 
lvwText    0       (Default) Matches the string with a ListItem object's Text property. 
lvwSubitem 1       Matches the string with any string in a ListItem object's SubItems property. 
lvwTag     2       Matches the string with any ListItem object's Tag property. 

The settings for match are:

Constant     Value  Description 
lvwWholeWord 0      (Default) An integer or constant specifying that a match will occur if the item's Text property begins with the whole word being searched. Ignored if the criteria is not text. 
lvwPartial   1      An integer or constant specifying that a match will occur if the item's Text property begins with the string being searched. Ignored if the criteria is not text. 

Remarks

If you specify Text as the search criteria, you can use lvwPartial so that a match occurs when the ListItem object's Text property begins with the string you are searching for. For example, to find the ListItem whose text is "Autoexec.bat", use:

'Create a ListItem variable.
Dim itmX As ListItem
'Set the variable to the found item.
Set itmX = ListView1.FindItem("Auto",,,lvwpartial) 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close