List View Find Text By Corrosponding Columns
Hi, i have a list view with 2 coumns and it retrieve information from a server and it contains different amounts of information at once.
What i need to do is locate in the first column of the listview anything containing the index "hostname" then go retrieve the hostname which would be in the next column in the exact row. So it looks like this
Column 1 - Column 2 ===================== ip add - 192.168.blahblah hostname - TheTestName
i want to retrieve "TheTestName" by finding the column "hostname" but i have no ideas how to achieve this. If anyone could help me out that would be great.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
LIst View - Subitem Text Find
I have question for you about Microsoft List View.
Below there is piece of code.
My problem is followiing. I'd like to find subitem text in list view , but I get Msgbox "No match found", I don't why.
If the second argument lvwSubItem will be replaced by lvwText there is no any problem.
Could you help me ?
Regards
Waldemar Brodowski, Poland
**************************
Dim itmFound As ListItem ' FoundItem variable.
Set itmFound = lvwCabinetModule.FindItem("string", lvwSubItem, , lvwPartial)
If itmFound Is Nothing Then ' If no match, inform user and exit.
MsgBox "No match found"
Exit Sub
Else
itmFound.EnsureVisible ' Scroll ListView to show found ListItem.
itmFound.Selected = True ' Select the ListItem.
' Return focus to the control to see selection.
lvwCabinetModule.SetFocus
End If
**************************
2 Columns In List View:
i ahve a list view box, when i click the add button, i need to be able to add:
add.text in the first column
desc.text in the second column
but i can only get add.text in the first column.......
Ordering Columns In A List View
I know I can use the ascending and descending properties to order the first column in a list view, but how can I order the other columns as well?
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.
List View Select - Multiple Columns
I have a listview control with two columns...
1. File Name
2. Extension
When I selected the file I return the file name, but if i want to retrieve the properties regarding the file i need the extension which is in column 2...
This will get the information in column 1 (File Name)
Set objFile = objFSO.GetFile(DirList.List(DirList.ListIndex) & "" & lstFileList.SelectedItem.Text)
How do I get it so that it gets the info in column 1 and adds the info of column 2 to that string? i.e.
file name extension
mydoc doc
myvideo avi
myemail eml
i want it so that when i click on mydoc the string becomes... mydoc.doc, any ideas? thanks
- gabe
How Do I Hide/unhide Columns In A List View?
I want the user to choose the columns for a specified output though all the columns will be filled
with data , i want to display only those columns which the user selects.Currently i make the width
of the hidden column as - 0 but that the user can just keep his mouse on the header and drag to
see the hidden column. How do I actually hide it???
Sorting On DATE Columns In MS List View
Does anybody know how to get this to work?
The listview seems only capable of accepting strings as it's items so dates have to be converted to text and therefore are sorted as text.
How can I get around this?
Freeze The Columns Of List View Control
Hi Gurus,
I want to freeze the columns of a Listview control in Report view mode. Is there any property of List View or any other code example to show me how to prevent the columns to be resized by the user?
Help me plz, it is really necessary.
Waqas...
2 Qs : Timer And How Do I Hide/unhide Columns In A List View?
hi,
2 questions
For a listview, I want the user to choose the columns for a specified output though all the columns will be filled with data , i want to display only those columns which the user selects(Like we have it in windows explorer). Currently I make the width of the hidden column as - 0 but that the user can just keep his mouse on the header and drag to see the hidden column. How do I actually hide it???
Second question:
I have just recently find out that one cannot set the interval time of a timer for than 65000 millisecs that is apporx a minute. How do I set the interval of a timer for more than a minute say 3 minutes?
Thanks.
How To Sort Columns In List View -- Just Like Windows Explorer
Hi,
I am using ListView Control.. I want to sort the listview on a particular column when user selects it. Is there any direct way of doing this.. And can I set colors to rows in a Listview control.. Like I have a situation where I want alternate colours to be displayed.. Is it possible
Regards
Surya Prakash
List View Text
I need to know how to retrieve text from a listview box, I've been reading, but no luck yet, I have played around with it and figured out how to use the LVM_getitemcount, but i can't figure out the LVM_GETITEMTEXT.
List View Adds A 1 To A Text Box
Hey guys I have a listview called and I was wondering I have a text20.text that currently has a 0. If something gets added to that list view then the number in the text box goes up by 1, so it would be 1,2,3,4,5, etc.
The list view is called lvwFound
Would I use a if then statement that would be like
If 'whenever something gets added to the lvwFound Then
Text20.Text = Val(Text20.Text) + 1
End If
Also I would like that number to be saved to a text file, thats not problem to do, but what event would it be called when the program closes?
Thanks for your time and help guys!!
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?
List View - Drag Item In A Text Box
Hi!
I´m using a List View and some text boxes. I want populate the text of text boxes drop&draging the items of my list view. It's that possible? Any trick? Thanks in advance,
Hélder Barros
Retrieving Text From A List View Control
Hi, i would like to know how to use LVM_GETITEMTEXT to retrieve data from a list view control. I have the declares already, i just dont know how to use it. Thanks
List View Selected Items In Text Boxes
Dear Friends,
When I select one item {because I have only one coloumn in listview } (eg: Name) from a listview which is connected to DB2.MDB (Table Name is : TB2) and displays the data from TB2, I would like all the text boxes to show all the records pertaining to the selected name. I have four fields in TB2.
What code should be written:
Search In List View With Respect To The Text Entered In Textbox.
hi ,
[give some code help please]
i have a list view populated with data items, and i also have a textbox through which i want to use search. i want to search in list view by writing in textbox in this scenaio.
i write "canada" in textbox in one by one character as like "c", "ca", "can" etc
then listview should take me on a letter what ever i entered in textbox
[Example:- list view is populaed with these word]
canada
united kingdom
france
germany
cairo
thanks
Reading Text File/Using Delimiters/Putting Into List View
Hey, haven't been here for several months. Main reason is I just shortly got back from Iraq. Ohh Rahh!
I'm sorry buy I might answer my own question(s) as I am tryping this out, I just have used vb for a long time so work with me people. (And point it out if I did answer my own question(s).
Ok here's my question I want to speperate a text file that has info in it that is set up like this:
Code:
Account:User1;Password:Help;Access:Restricted
Account:User2;Password:Me;Access:Restricted
Account:User3;Password:Please;Access:Restricted
Account:User4;Password:Thanks;Access:Restricted
Account:User5;Password:In;Access:Restricted
Account:User6;Password:Advance;Access:Restricted
Yes, it's been asked a 1,000 times by other people and yes I am looking around for the answer. But I seen that you (who ever is reading this) had the urge to help me out anyways.
1. I know I need to use something like this:
Code:
Dim Data(20) As String
Private Sub cmdLVFill_Click()
Dim TempCounter As Integer
Dim filenum As Integer
filenum = FreeFile
Open "C:Info.txt" For Input As #filenum
Do While Not EOF(filenum)
Input #filenum, Data(Counter)
Counter = Counter + 1
Loop
Close #filenum
Dim i As Integer
For i = 1 To Counter - 1
'Instr Stuff goes here? Then put the fields into an array.
' This is where I would put in my listview fun stuff
' Using Redim to store it all I suppose seeing how I don't know the length of the file.
'THis doesn't sound right to me but something along those lines...
Next
End Sub
2. I think I need to use Instr:
Code:
i = LineOfFIle
'as in line 1
'Account:User1;Password:Help;Access:Restricted
a = 1
Do While Not EOF(filenum)
a = InStr(i, ":")
b = Instr(a, i, ";")
Account = CStr(Mid(i, b, a - b))
c = Instr(b, i, ":")
d = InStr(c, i, ";")
Password = CStr(Mid(i, d, c - d))
'I don't know how bad or far off that is but It doesn't look right to me
This Text1.text Find In List1.list
errr... this should be simple but i cant do it ( ). I want to press a Button (command1) and it will select text in my list1.list, the shearch text will be from Text1.text. Can you tell me the code to do this please? <theres a better way of explainin that somewhere, but... i cant think of it.
Any help is, errrmm, Helpful, so thanx.
Visual Basic List View Control To View Network Computers
Hi,
I am working on simple network connect utility and ready with the functinality. But I am stuck at a very important aspect of the GUI where I need a List View Control that will view the computers from the available LAN domains. And will let us select a particular computer on expanding the domain List Item. If not a list view then a treeview rather.
Also will this control let me select a NETWORK COMPUTER ONLY but not shared folders on its individual drives. Only computers has to be selected. Not the nodes (folders) shared at them.
Thanks.
Vinitsankhe.
Windows File Explorer.. Icon View And List View.
I'm trying to duplicate a function of the explorer.. The folder contents view.
See example of what I mean...
http://www.ibarn.net/fun/files/thumblist.jpg
I can do everything I need using the filelistbox with the sole exception of changing the display style. I don't want a file list, I want a list-view or icon-view. (Preferably both, with the option to switch between them.)
So my question to you fine people is...... what API or component could I find this capacity in? I've looked at all of the components and didn't see anything that looked close, and a search on the subject yeilds hundreds of people trying to emulate the "filemanager" explorer style, but none trying to kick out a normal, boring icon view like this.
Any help would be greatly appreciated.
Thanks.
List View PopUp Prob (lvwIcon View) *Resolved*
Hi all,
I have a listview in large icon view (lvwIcon). I have a popup menu displaying some options when the user right clicks an item that is specific for that item.
My question is this -
I want a different popup menu to show when the user right-clicks on a blank area of the listview which would display general options.
In my testing, whenever a blank area is clicked, the selected item is the first item (if none had been selected) or the current selected item (if one had already been selected).
I currently use the selecteditem.text to determine what pop up menu is to be used.
I guess in theory the code might be something like ;
Code:
If lvwMain.SelectedItem = Nothing then
PopupMenu mnuGeneral
Else
PopupMenu mnuSpecific
End If
Any help would be greatly appreciated.
Cheers
Jack
Find Text Value Of Current List Item? *Resolved*
I would like to cycle though a list and execute a command for each item in the list.
What is the attribute that would allow me to know the Text value of the current list item?
Code:
Private Sub cmdGenerate_Click()
Dim i
For i = 0 To lstNumbers.ListCount - 1
GenerateNumberList
txtMultiVehicleAdCopy.Text = txtMultiVehicleAdCopy.Text & "Yahoo! It worked" & vbCrLf
Next i
End Sub
Private Sub GenerateNumberList()
'I want to take the text value of the current list item and jump to that record BUT I cant seem to figure out how to find the current list item info/text
Data1.Recordset.MoveLast
Data1.Recordset.FindFirst "Number='" & lstNumbers.Text & "'" '<---Takes the List item Text and uses it to move the datacontrol to the record
'Need to know the value of the current list item "lstNumbers.Text" ??? doesn't give me the current list item text ie: "Item Number One" "Item Number Two" etc.
If chkCheckbox1.Value = True Then
txtNumberList.Text = txtNumberList.Text & "Yahoo!"
End If
End Sub
Edited by - Matrix1000 on 12/15/2003 3:18:39 PM
Matching List View To Tree View
Hi Everyone,
Quick Question. I have a list view and a Tree view that are sharing the same data. The Tree view control lists all the Task Names and the List view control has the task detail. (Start, End Date and resources.)
The only issue is that the Line widths do not match. The Tree View nodes have more white space between them then the list view. Is there a way that I can match the width of the tree view rows to the rows on the List view?
Thanks
BDS
List View, Tree View Controls
I have had the same problem... I ended up righting my own controls so that it would run faster on the population of the control...
Sorry
Brooke
How To View The Datatypes Of Every Columns
Hi all
anyone here, knows how to view the data types, i'm using vb 6 front and oracle as back end.
What i want to do is this : Examples:
i have table EMP: columns= Fname,age,D_Date:
i want to view like this:
Column_name | DataTypes | Null
Fname | varchar2(30) | not null
Age | number(2) |
D_Date | Date |
Is this possible?
Removing Columns From Datasheet View
Hi all, please help!
I have a subform (in datasheet view) that has to show/hide different columns under different contexts.
I tried
mytextbox.visible = false
where mytextbox is a textbox in the subform. This hides the textbox in Form View, but doesn't do the trick in Datasheet View.
I also tried
mytextbox.ColumnHidden = true
This method hides the column in the datasheet, but the column is still in the datasheet. So the user can bring the hidden column back by resizing the column (dragging the column header).
It there any way to truely hide/delete/remove a column from a datasheet view???? I've looked everywhere on web, but in vein.
Any help would be greatly appreciated! Thanks in advance!!!
-- kothreat@yahoo.com --
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,
Select Folder Dialog. List All Folders And Subfolder In List View
Hello all.
I am trying to select a folder in a folder dialog. I then want it to list all the folders and subfolders and files within the selected folder in the list view.
this is what i have so far. It just lists all the first children folders of the selected folder. any help on this?
Code:
Private Sub addFolders()
FolderBrowserDialog.ShowDialog()
ListView1.Items.Add(FolderBrowserDialog.SelectedPath) 'lists top selected folder
Dim STF As New IO.DirectoryInfo(FolderBrowserDialog.SelectedPath)
Dim F As IO.DirectoryInfo
'lists each folder inside top folder
For Each F In STF.GetDirectories()
ListView1.Items.Add(F.Name)
Next
End Sub
List Box - How To Have Left && Right Aligned Columns In The Same List Box.
Hi,
Excel 2000, VBA
Is it possible to have the different columns with left & right alignment in the same list box.
ie. columns 1 & 2, left aligned and column 3, right aligned.
One way I can think of is to place another list box over column 3 of the first list box, but it does make for fiddly coding.
I've googled, but not found anything. Any suggestions welcome.
Regards
What Is The Limits On COmbo Box, List Box And LIst View And How Do You Handle Situations W
OK<
I have looked at all 5 of my vb Barnes and noble books
under listbox
and did not find where it said what the limit was.
I learned how to read a data base (unbound even) into a list box, or combo box.
But now I have over 32,768 items,
my data base list has between 100,000 - 125,000 Parts I want to load.
I can think of a lot of cases where the data base you want to load into a list or combo box is well of 32768
So my questions are
( I did also search VBCITY)
1) What is the limits on
listbox
combo box
list view
and
where is it documented.
and 2
How do I handle the case of more than 32768 with a listview??
I did found a little bit about it on vbcity
Thanks
Changing To A List View Instead Of A List Box To Overcome 32768 Limits
I had the program done
I was loading a listbox and typing is a text box watching the closest match be selected.
I start off by filling the list box from a mdb with a table called partlist,
and a field called part numbers
It worked fine.
But now because I am over 32768 ( I will never go over 125,000) records, I am past the usefullness of a list box I guess.
so How do I change this code that works with a listbox, to code that works with a viewbox
and is this my best solution
Here is the listbox working code
Public Function FillListboxparts(Optional PartNumber As String)
Screen.MousePointer = vbHourglass
Dim li As ListItem
Dim lih As ListItem
Dim cnn As ADODB.Connection
Dim rsPartList As ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT PartNumber From partlist"
Set cnn = New ADODB.Connection
cnn.Open ConnString
Set rsPartList = New ADODB.Recordset
rsPartList.Open strSQL, cnn
While Not rsPartList.EOF
listboxparts.AddItem rsPartList("Partnumber")
rsPartList.MoveNext
Wend
Text1.Text = listboxparts.ListCount
rsPartList.Close
Set rsPartList = Nothing
cnn.Close
Set cnn = Nothing
Set li = Nothing
Set lih = Nothing
Screen.MousePointer = vbDefault
End Function
Tree View + List View
Hai,
In my application, I have Tree view on left side and List view on the right side which is just like windows Explorer. I would like to get the same functionality like Explorer where you can move the seperator between Tree View and List View. That means I would like to make the List View wider or shorter as I wish.
Can any body help me?
Thanking you in anticipation
Selected List View Field To List Box
hi,
I Have list view control with check box, when i select the record the record to be displayed in list box,The event is geting trigered but the problem is that if i have multiselction or another row selection the exiting record disappears from the list box.
*RESOLVED* Getting Selected Item In List View To Move Into View*RESOLVED*
Hi, I am trying to get a List View to act like a combo box. At the top of the List View there is a text box where the following code searches the List View for the text entered, I have this code in the Change event of the text box so a search is done on each letter typed.
The code finds the record without a problem but I want it to move to the top or into view. Right now I have to scroll down to find the record it selected. Anyone have any ideas? Here is my code:
Code:
Private Sub txtFindFirst_Change()
Dim i As Integer
Dim l As Long
On Error GoTo NoRecord
If txtFindFirst = "" Then
GoTo NoRecord
Else
l = Len(txtFindFirst.Text)
For i = 1 To lstContacts.ListItems.Count Step 1
If StrConv(txtFindFirst, vbUpperCase) = StrConv(Left(lstContacts.ListItems(i).Text, l), vbUpperCase) Then
lstContacts.ListItems(i).Selected = True
Exit Sub
Else
End If
Next
End If
NoRecord:
On Error GoTo NoList
lstContacts.ListItems(1).Selected = True
strTransferID = lstContacts.SelectedItem.ListSubItems(1).Text
Exit Sub
NoList:
Exit Sub
End Sub
Thanks in advance for any help.
How To Find # Of Columns
is there a property that a dbgrid or data control has that contains that number of columns?
thanks
gary
ADO Multi Columns Find
I am DAO programer, and want to migrate to ADO
I just discovered that ADO recordset can not find multi columns like this:
rs.find "[Item] = '0001' and [Color] = 'Blue'"
what I should do to fix this problem, do I have to use "seek" and create a lot of index since DAO allow Findfirst that very useful
Thank you
Find Ammount Of Columns In Csv File
Hi
Is it possible to find out the ammount of columns a .csv file has just before importing it in a vb application?
Thanking you in advance
PORRASTAR
Find Values In Multiple Columns.
Hi guys.
My client has double backed on what they want and i'm starting this project again.
I'm trying to loop thru a range and count the matches.
Example.
Loop Column A and count all values which have "A" as value
Set the count value as a label1.caption
Loop Column B for value of "1" and Column A value of "A"
set the count value as label2.caption
Loop Column C for value of "1","4" or "2","8","9" or "3","5" and column A value of "A" and column B value of "1"
set the count value as label3.caption
this is then repeated for Column A value of somthing else but the Column B and C will remain the same.
I've tried with If statements and failed, im now trying with select cases.
Code:
Public Sub Basic()
ActiveWorkbook.Sheets(1).Select
Dim col As Integer
Dim cel As Range
Dim SelRange As Range
Dim SelRange2 As Range
Dim SelRange3 As Range
Dim totalrows As Integer
For col = 1 To 1 'columns A to A
For Each cel In Range(Cells(1, col), Cells(65536, col).End(xlUp))
Select Case cel
Case 1
Select Case cel
Case 1
If SelRange Is Nothing Then
Set SelRange = Range(Cells(cel.Row, 1), Cells(cel.Row, 52))
totalrows = SelRange.Count
BacklogFinder.lblfreqtotal1.Caption = totalrows
Else
Set SelRange = Union(SelRange, Range(Cells(cel.Row, 1), Cells(cel.Row, 52)))
totalrows = SelRange.Count
BacklogFinder.lblfreqtotal1.Caption = totalrows / 52
End If
End Select
Case "2"
Select Case cel
Case "2FBARS2"
If SelRange2 Is Nothing Then
Set SelRange2 = Range(Cells(cel.Row, 1), Cells(cel.Row, 52))
totalrows = SelRange2.Count
BacklogFinder.lblfreqtotal2.Caption = totalrows
Else
Set SelRange2 = Union(SelRange2, Range(Cells(cel.Row, 1), Cells(cel.Row, 52)))
totalrows = SelRange2.Count
BacklogFinder.lblfreqtotal2.Caption = totalrows / 52
End If
End Select
End Select
Next cel
Next col
end sub
notice the / 52 after the totalrows.
This is because is makes a union of all 52 columns which is needed for the future part.
The future part is to copy all the matching rows and paste them into a spreadsheet.
I divide by 52 as if it finds a match for cell value the union binds teh cells which total 52 and make a boo boo of the overall count.
ANy ideas would be great.
Al
http://www.stormitsolutions.com
http://www.stormitsolutions.co.uk
Allan Nisbet - Web & Software Developer
VB *.*, PHP, D/HTML, VBScipt, ASP, CSS, MySQL, Access, MSOffice,
***Please Mark Posts Resolved when you get your answer***
SQL is the Devil!
Edited by - Big Al Inc on 8/30/2007 7:23:23 AM
List View List Subitems Help
Hi guys,
Im generating a time based values which im adding to my listview (report style) under three columns before a new row is generated. Now i want to add another value to column 4 nly how do i do that??
i think it has something to do with:
Set listsubitem1 = listitem1.ListSubItems.Add() ????
but i want to add under column 4 continously??
help!
Trying To Find Missing Fields In A DB Useing 2 Columns
I have 2 tables,
tbltime: Jobid, Phasecodeid, hours, date, etc.
PhaseCostTest: Jobid, Phasecodeid, cost
What I want to do is find all of the entries in tbltime that are not in phasecosttest based on their jobid,phasecostid. I would then like to add these missing entries to PhaseCostTestwith a cost of 0. The jobid and PhaseCodeID are int values so they need to be cast to strings for the concationation. The problem is that I need the phasecode and jobid as a pair. a jobid will have many phase codes, and the phasecodes are all in the same overall set of numbers for all jobs.
Ive been trying things like :
SELECT t.*, RTRIM(CAST(t.Jobid AS CHAR (5))) +'-'+ RTRIM(CAST(t.PhaseCodeID AS CHAR (5))) as 'x'
FROM tbltime t
WHERE not EXISTS (
SELECT RTRIM(CAST(c.Jobid AS CHAR (5))) +'-'+ RTRIM(CAST(c.PhaseCodeID AS CHAR (5))) as 'y' FROM PhaseCostTest as c WHERE 'x' = 'y')
But this just returns all of the rows in tbltime. Any ideas how to get something like this to work?
Thanks!
Dataview.Find With String And Date Columns
I am trying to search a dataview sorted on a string and a date field. Here is the code:
Dim f As New frmGetInvDate
f.GetInvoice(cmContracts)
If f.DialogResult = DialogResult.OK Then
Dim v As New DataView
v.Table = dsI.Tables("tblInvoices")
v.Sort = "fkStrContractID, dtmInvPeriodEnd"
MsgBox(v.Count)
Dim foundrows() As DataRowView = v.FindRows(New Object() {f.ContractID, f.WEDate})
If foundrows.Length > 0 Then
MsgBox("found!")
Else
MsgBox("not found")
End If
End If
f.Dispose()
I don't get any returned rows. If I remove the date field from the Sort and from the FindRows method, it works.
Please help!
Thanx,
Gerry
Columns In A List Box
Well then I am wanting to make 3 columns in a list box. So I thought it would be as simply as padding each value so it holds 20 spaces using this function:
Code:
If txtName.TextLength < 20 Then
For i = 1 To 20 - txtName.TextLength
txtName.Text = txtName.Text & " "
Next i
End If
The other two variables are constant size so there was no need to change them, the values are stored in a textfile and updated using the method below. When you view the text file they are pefectly placed in it but when I update the listbox, the spacing goes wrong. Any ideas why?
Code:
Public Sub updatelstbox()
On Error GoTo errorhandler
frmContact.lstcontact.Clear
Dim dump As String
Open "M:Messageuserdata.txt" For Input As #1
Do While EOF(1) = False
Input #1, dump
frmContact.lstcontact.AddItem (dump)
Loop
Close #1
errorhandler:
Exit Sub
End Sub
So in a nut shell from a perfectly spaced textfile updating it to a listbox it doesn't show the values correctly any ideas why?
- Further clarification just ask
|