Listview; Getting Data (populate Listview) From 2 Tables??
hi!
im using a listview of my program.. where i need popluate the it with data coming from 2 tables, (table 1 and table 2); and where one of the entities in both table are the same... for instance; table 1 = stud_genInfo table 2 = stuf_Offenses both has the entity= stud_Number.. in which i need to show the stud number in my listview..
how can set (code) to show the Stud_no.?? confused:
can anyone help me with this one?? pls i need ur help, badly...
i would appreciate all the help/suggestions anyone would give..
mauve ----- btw, this is a snip of my code:
strToday = Format (now, "mmddyyy") With rsSearch .Open "SELECT * FROM GenIndo, Offenses WHERE Schedule.Date_Today = '" & strToday & " ' And Schedule.Stud_No =CheckUp.Stud_No", CN, adOpenStatic, adLockPessimistic
If .RecordCount <= 0 Then lvwSchedule.ListItems.Clear Else lvwSchedule.ListItems.Clear .MoveFirst Do Until .EOF
Set xlist_item = lvwSchedule.ListItems.Add(, , !Stud_NO) ' this is the line(part) where VB highlights the error
xlist_item.ListSubItems.Add , , (UCase(!Last_Name) & ", " & !First_Name & " " & !Middle_Name) xlist_item.ListSubItems.Add , , (!Offense) xlist_item.ListSubItems.Add , , (!Offense_Type) xlist_item.ListSubItems.Add , , (!Offense_No) .MoveNext Loop End If .Close End With Set rsSearch = Nothing
-------
thank u so much...:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Populate Data From Two Tables To Listview
Hi Everyone,
I have two tables, Customer and Orders it has a relationship by AccountID. Each customer will have multiple orders. Everytime I added a new order to Orders database for a customer, the listview shows up another record of the same customer except order is different Why is that? Could it the Relationship with AccountID?. I have 2 listviews. One is for Customer info and the other will show all the orders from the individual customer when I click on that customer. What SELECT statement do I use? or is there a better way?
Populate SQL Data Into A Listview
I'm not as sharp as I would like to be, with database programming.
After making an ADO connection, what is the best method to populate SQL Server data into a Listview?
Any sample code would be great!
TIA
How To Populate Listview With Remote Xml Data?
Hi all. i have the following remote rss xml in rss.php I want to populate the xml data to vb6 listview. could any one show me how this can be done.Thanks
Note:The number of items in xml is dynamic not fixedrss.php
PHP Code:
<playlist>
<song>
<artist>artistname1</artist>
<name>artistname1</name>
<image>image1.gif</image>
<rating>2028574083</rating>
<songid>566</songid>
<totalvotes>09898</totalvotes>
</song>
<song>
<artist>artistname2</artist>
<name>artistname2</name>
<image>image2.gif</image>
<rating>2028574083</rating>
<songid>566</songid>
<totalvotes>09898</totalvotes>
</song>
...
</playlist>
How To Populate Listview With Remote Xml Data
Hi all. i have the following remote rss xml in rss.php I want to populate the xml data to vb6 listview. could any one show me how this can be done.Thanks
Note:The number of items in xml is dynamic not fixed
rss.php
CODE <playlist>
<song>
<artist>artistname1</artist>
<name>artistname1</name>
<image>image1.gif</image>
<rating>2028574083</rating>
<songid>566</songid>
<totalvotes>09898</totalvotes>
</song>
<song>
<artist>artistname2</artist>
<name>artistname2</name>
<image>image2.gif</image>
<rating>2028574083</rating>
<songid>566</songid>
<totalvotes>09898</totalvotes>
</song>
...
</playlist>
Populate Data Into Array From ListView
I am trying to populate an Array with data from a Listview. I need to populate the array so I can used it for further processing. Right now I have managed to messagebox the contents of the Listview.What ever data is in the listview should go into the array. Can someone help me please.
Code:
Private Sub CmdExport_Click()
Dim X, Y As Integer
Dim RowCount As Integer
RowCount = Me.LstVwImportFields.ListItems.Count
Dim Matrix() As String
ReDim Matrix(RowCount, nCols) As String
'Contains 5 rows and 2 columns
For Y = 1 To Me.LstVwImportFields.ListItems.Count
MsgBox Me.LstVwImportFields.ListItems(Y).Text
For X = 1 To nCols - 1
MsgBox Me.LstVwImportFields.ListItems(Y).ListSubItems(X).Text
Next
Next
End Sub
A VB turned PHP geek
Edited by - paCkeTroUTer on 7/15/2003 9:57:19 AM
Populate ListView
Could someone tell me why this is not working? I'm getting an error Type mismatch. Thanks
Code:
Dim intFNum As Integer
Dim li As ListItem
Dim TempString As String
On Error GoTo dbErrHandler
intFNum = FreeFile
If LenB(Dir$(App.Path & "Product List.txt")) Then ' Checks if the file exists
Open App.Path & "Product List.txt" For Input As #intFNum
Do While Not EOF(intFNum)
Set li = TempString
Form1.CoNamecmb.Items.Add (li)
Loop
Close #intFNum
End If
Exit Sub
Populate Listview
Can someone please tell me how to add items to a listview. I have the following, but it doesn't work:
Code:
With rsFLEETS
.Open "SELECT * FROM EQTypeSummary ORDER BY EQTYPE DESC"
End With
Do While Not rsFLEETS.EOF
Set lvNode = ListView1.ListItems.Add(, , rsFLEETS!EQTYPE)
lvNode.SubItems(1) = "" & rsFLEETS!EQTYPE
lvNode.SubItems(2) = "" & rsFLEETS!Description
lvNode.SubItems(3) = "" & rsFLEETS!Tag
lvNode.SubItems(4) = "" & rsFLEETS!regular
rsFLEETS.MoveNext
Loop
I have never used ListView before.........Please help!
Cannot Get 2nd Listview To Populate
Hello all,
Can anyone see why my second listview (lvwWeapons) is not populating.
The first listview populates just fine, but the second one will not.
vb Code:
Private Sub lstInvestigators_Click() Dim oItem As ListItem Dim strInvestigators As String If lstInvestigators.ListIndex <> -1 Then strInvestigators = lstInvestigators.List(lstInvestigators.ListIndex) strSQL = "SELECT Investigator.*,Weapons.*,Cameras.*,Computers.*,Radios.*" _ & " FROM (((Investigator" _ & " LEFT JOIN Weapons ON Investigator.FDID = Weapons.WeaponsFDID)" _ & " LEFT JOIN Cameras ON Investigator.FDID = Cameras.CamerasFDID)" _ & " LEFT JOIN Computers ON Investigator.FDID = Computers.ComputersFDID)" _ & " LEFT JOIN Radios ON Investigator.FDID = Radios.RadiosFDID" _ & " WHERE Investigator.FDID = '" & strInvestigators & "'" rs.Close Debug.Print strSQL rs.Open strSQL, DBConn, adOpenForwardOnly, adLockReadOnly, adCmdText End If Fillfields lvwCameras.ListItems.Clear lvwWeapons.ListItems.Clear For i = 0 To lstInvestigators.ListCount - 1 If lstInvestigators.Selected(i) = True Then strInvestigators = lstInvestigators.List(lstInvestigators.ListIndex) Do Until rs.EOF = True Set oItem = lvwCameras.ListItems.Add(, , rs.Fields("CamerasSerial_NO").Value & vbNullString) oItem.ListSubItems.Add , , rs.Fields("Camera_Make").Value & vbNullString oItem.ListSubItems.Add , , rs.Fields("Camera_Model").Value & vbNullString oItem.ListSubItems.Add , , rs.Fields("Camera_Asset_NO").Value & vbNullString rs.MoveNext Loop Do Until rs.EOF = True Set oItem = lvwWeapons.ListItems.Add(, , rs.Fields("WeaponsSerial_NO").Value & vbNullString) oItem.ListSubItems.Add , , rs.Fields("Weapon_Make").Value & vbNullString oItem.ListSubItems.Add , , rs.Fields("Weapon_Model").Value & vbNullString oItem.ListSubItems.Add , , rs.Fields("Caliber").Value & vbNullString rs.MoveNext Loop End If NextEnd Sub
Need Help To Populate Listview Using Sql
I use listview1 to display list of Fields name from a table. Now I add another listview2 to display fields name user select from listview1. I use listview1_doubleclick event to add item to listview2. Ok this part I done successfully.
Now I add record filtering section on my form and add cboFields, cboOperator and txtSearch. These 3 controls needed to create the sql query. Ok now when user select field eg. ID, operator eg. < and type 10 into txtSearch I have a complete sql query as follow
Quote:
SELECT ID,NAME,ADDRESS FROM PATIENT WHERE ID < 10
This is the code I use so far
VB Code:
Dim squery As String, sQuery1 As String, sString As String Dim iCount As Integer, jCount As Integer 'Add column headers base on user selection For iCount = 1 To lv2.ListItems.Count sString = sString + "," + lv2.ListItems.Item(iCount) Set iCol3 = lv3.ColumnHeaders.Add(, , lv2.ListItems.Item(iCount)) Next iCount 'Create a query record squery = "SELECT " & Mid(sString, 2, Len(sString)) & " FROM MAKLUMAT_RAWATAN " If cboFields = "Age" Then sQuery1 = "WHERE " & cboFields & " " & cboOperator & "" & txtSearch Else sQuery1 = "WHERE " & cboFields & " " & cboOperator & "'" & txtSearch & "'" End If 'Test if user use filtering or not If cboFields = "" Or cboOperator = "" Or txtSearch = "" Then squery = squery + sQuery1 Else squery = squery End If RS.Open squery, con, adOpenDynamic, adLockOptimistic 'Add Records (I Got problem here... How can I the query here?) For iCount = 0 To RS.RecordCount - 1 Set iItem3 = lv3.ListItems.Add(, , RS(0)) 'Id 'Add subitems For jCount = 1 To lv2.ListItems.Count - 1 iItem3.ListSubItems.Add , , RS(jCount) Next jCount RS.MoveNext Next iCount
As you can see the 'Add Records section, I have problem to use the sql query to populate listview3. Can anybody help
How To Populate Listview
i know how to manually enter the subitems in the listview. i would
like to know how to call a text file thats on my desktop to populate
my empty listview control.
planejanezz
Populate Listview From Txt File
this is what i've got
Code:
Dim FF As Integer
dfile = "c:123.txt"
FF = FreeFile
Open dfile For Input As FF
Do While Not EOF(FF)
Line Input #FF, mlin
strLines = Split(mlin, vbCrLf)
For j = 0 To UBound(strLines)
If strLines(j) <> "" Then
>>what goes here??<<
End If
Next j
Loop
Close FF
How To Populate Columns Of Listview
Hi all i dragged a listview to my form and now i want to populate the following data to one of its column but i do not how to populate a listview and how to specify the number of column on it. i have another function that needs to populate the second column of listview too.I be happy if some one show me how that can be then.Thanks
VB Code:
For N = LBound(sResult) To UBound(sResult) List2.AddItem [b]"http://localhost/" & sResult(N)[/b] Text3.Text = [b]Text3.Text & "http://localhost/" & sResult(N) & vbCrLf[/b] Next N
Populate ListView (5 Columns)
Hi,
I would like to display a recordset in a listview.
The listview has 5 columns, the recordset has 5 colums ( a SQLDataReader object)
While reader.Read()
' for each column in the listview
Dim i as integer
for i=0 to 4
<? what goes here ?>
next i
End While
Thankyou very much!
How To Populate A Listview From A Textfile?
I have a commadelimited textfile like this.
Value1,Value2,Value3
Value1.1,Value2.1,Value3.1
I want to populate this file in to a listview ( in lvwReport mode )
So it looks like:
Column 1 I Column2 I Column3
---------------------------------------
Value1 I Value2 I Value3
---------------------------------------
Value1.1 I Value2.1 I Value3.1
And so on.....
And save it back to the file. How shall i do?
Listview Populate From Another Form?
How do I populate a listview from another form? The form with the listview has a sub called 'PopulateListView' and is an MDI child. I tried calling the sub from another form with: frmName.PopulateListView, which works, but opens the form if it's not open.
I've been fiddling with this for a long time, so any help appreciated.
Ta.
Populate Listview With Strings
How can i populate a listview with strings i'm getting from a textfile
code i already have:
Private Sub Form_Load()
sBestandspad = "ATR.dat"
sFileToOpen = App.Path & sBestandspad
FillListBox (sFileToOpen)
End Sub
Public Function FillListBox(sFileOpen)
Dim itmX As ListItem
Open sFileOpen For Input As #1
Do Until EOF(1)
Line Input #1, sline1
Set itmX = Me.ListView1.ListItems.Add(, , sline1)
Loop
Close #1
End Function
How To Populate A Listview Control
VB6
I have never used a listview control before, and I am struggling with populating it. I have a listview control named ListView1. I would like the first column to be numbered, and the second column to be populated with strings from an array (arrNames). Basically, the ListView should display something like this:
1 Derek
2 Joe
3 Steve
4 Will
5 John
If anyone could get me moving in the right direction I would truely appreciate it. I don't need help with the actual looping through the array, just with the commands to populate the listview. TIA...
Populate Txt File Into ListView
Hello,
I need to populate a txt file (with many lines) with this format:
name,x,y,z
and populate them to a listview with 4 columns,
anyone can help me, please.
Best regards,
António Miranda.
How To Populate A Listview As Fast As That Of A Datagrid
hello,
my problem is that it takes too much time to additems to a listview when for example we have 9000 records.
Is there a way to make the listview load the data from a table as fast as a datagrid ?
because then, while populating the listview, you can't use the form, you must wait.........
any suggestion or ideas ?
thanks
Populate Listview From Query That Has Criteria
im trying to populate a listview from a query in my database. only problem im having is, my query has criteria (Employee Number). how do i get the query to run given the user will click/select the employee number from another listview on another form? any suggestions?
Cheers
How To Populate A Listview With Files From A Folder?
How do I get an explorer type view of files in a folder using a listview?
i.e. how do I get the files to show up in a listview as icons. If not a listview what else should I use so users can double click the files shown to open them in their native programs.
thanks
Access/ListView Populate Problem
I am trying to go about this a different way and I am getting an error as follows:
Quote:
cant assign to read-only property
modPublicVariables
VB Code:
'FOR ALL FORMS THAT ACCESS BACKEND DATABASE'FOR ALL FORMS THAT ACCESS BACKEND DATABASEPublic strSQL As StringPublic conn As ADODB.ConnectionPublic rs As ADODB.Recordset 'SETTINGS PAGE, CURRENCY LISTVIEWPublic strCurrSymbol As StringPublic strCurrDesc As StringPublic LstItmAvailableCurr As ListItem
modListView
VB Code:
Public Sub LoadCurrencies() CreateConnection strSQL = "SELECT * " strSQL = strSQL & "FROM CurrencyList " Do While Not rs.EOF strCurrSymbol = rs.Fields("CurrencySymbol").Value strCurrDesc = rs.Fields("CurrencyDescription").Value Set LstItmAvailableCurr = frmSettings.lvwDefaultCurrency.ListItems.Add(, , strCurrSymbol) LstItmAvailableCurr(1) = strCurrDesc rs.MoveNext Loop CloseConnectionAndRecordsetEnd Sub
I am then calling LoadCurrencies within the click event of my SSTab.
CreateConnection looks like:
VB Code:
Public Sub CreateConnection() Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.CursorLocation = adUseClient conn.Open "Provider=Microsoft.JET.OLEDB.4.0;Data Source=bmp.mdb;Persist Security Info=False"End Sub
CloseConnectionAndRecordset looks like:
VB Code:
Public Sub CloseConnectionAndRecordset() rs.Close Set rs = Nothing conn.Close Set conn = NothingEnd Sub
What am i doing wrong pls?
How To Populate The Listview With MSAccess Table?
hi,
i have a listview which i want to populate with one MSAccess table named client_details, i have written the program and ran it, there is no error only problem is that the table is not visible in that listview, plz check if my code is correct or not. The code is given below
VB Code:
Option ExplicitDim mclient_profilequery As StringDim mdate As StringDim mSerialno As StringDim mContactperson As StringDim mCompany As StringDim k As IntegerDim ki As Integer Private Sub cmdopen_Click()Select case "Company"Case '"clientprofile"mShowPrevious = TruefrmClientProfile.Show End Sub Private Sub Form_Load()connect_detailsPopulateDataEnd Sub Public Sub PopulateData()lvwclientprofiles.ListItems.Clearmclient_profilequery = "SELECT * FROM client_profile "If rs1.State = 1 Then rs1.Closers1.Open mclient_profilequery, con, adOpenStatic, adLockReadOnly If rs1.EOF = True Or rs1.BOF = False Then Exit Subrs1.MoveFirstk = 1ki = ""Do While Not rs1.EOF = Trueki = "clientprofile" & k lvwclientprofiles.ListItems.Add k, ki, rs1.Fields(0).Value lvwclientprofiles.ListItems(1).SubItems(1) = rs1.Fields(1).Value lvwclientprofiles.ListItems(2).SubItems(2) = rs1.Fields(2).Value lvwclientprofiles.ListItems(3).SubItems(3) = rs1.Fields(3).Valuek = k + 1rs1.MoveNextLoopEnd Sub Private Sub lvwclientprofiles_ItemClick(ByVal Item As MSComctlLib.ListItem)mdate = mdate.TextSerialno = Item.SubItems(1)Company = Item.SubItems(2)Contactperson = Item.SubItems(3) End Sub
Edit: Added vbcode end tag and corrected vbcode begin tag - Hack
Conditionally Populate A ListView Control
Hi All,
I am stuck to a very ridiculous problem.
I need to populate a ListView control from a function of another form (that means the code will be written in a different form than the one in which the ListView control is) conditionally. The condition is that the entry should not be already present in the ListView control. Suppose I want to add "ABCDE" to the ListView. For that I have to first check that "ABCDE" is not already there in the ListView, then add "ABCDE" to it or do nothing otherwise. All we are talking about is only the first column of the ListView.
This should be a damn simple problem but I don't know why I could not make it.
Please help soon.
How Do I Populate A 2 Column Listview?<===RESOLVED
I am opening an Access database and I am trying to populate my 2 column Listview from a table in the database.
VB Code:
x = 0 If Not rsMyRS.EOF Then rsMyRS.MoveFirst Do While Not rsMyRS.EOF frmDefaultEOIErrorCodes.lstvEOIErrors.ListItems(x).Text = rsMyRS!EOIErrorMessage frmDefaultEOIErrorCodes.lstvEOIErrors.ListItems(x).SubItems(2) = rsMyRS!EOIErrorNumber myArray(x, 0) = rsMyRS!EOIErrorMessage myArray(x, 1) = rsMyRS!EOIErrorNumber x = x + 1 rsMyRS.MoveNext Loop
I am getting an "Index Out of bounds" Error on the first ....ListItems(x) statement. so what is the proper way to populate this Listview?
How Do I Populate A ListView Control With An XML File?
Hi,
I need some help populating a ListView Control in VB 6 by opening and parsing an XML file, such as the following:
<?xml version="1.0" ?>
- <!-- Created with Vim 6.1 available at http://www.vim.org
-->
- <Invoice>
- <Shipping_Label>
<Name>Indecisive Management Solutions</Name>
<Address>123 Cannot Decide Which Way</Address>
<Postal_Code>A1B 2C3</Postal_Code>
<Telephone>416-123-4567</Telephone>
<Email>indecisive@unreliable.server.com</Email>
</Shipping_Label>
- <OrderItems>
- <Item>
<ItemNo>1</ItemNo>
<Code>AB1234</Code>
<Description>Yes Men</Description>
<Quantity>12</Quantity>
</Item>
- <Item>
<ItemNo>2</ItemNo>
<Code>CDE567</Code>
<Description>Stop watch</Description>
<Quantity>34</Quantity>
</Item>
- <Item>
<ItemNo>3</ItemNo>
<Code>FGH890</Code>
<Description>Buzzers</Description>
<Quantity>56</Quantity>
</Item>
- <Item>
<ItemNo>4</ItemNo>
<Code>IJKL34</Code>
<Description />
<Quantity>78</Quantity>
</Item>
</OrderItems>
</Invoice>
Thanks for your help!
ListView Populate From External Database Problem
I am writing a program that will allow users to see other members and get additional information about them. When you click someone's name in the ListView a new popup will appear with additional data. Everything works fine if you enter the data manually into the dat file. Instead of using a dat file I would like to be able to connect to an external database and do the same thing. I do not know if i need to save the data locally to user's machine or not since the coding isnt straight from the dat but passed thru a GetToken function. Below is what I have working now:
**************start code**************************
Private Sub FilllvLIST()
On Error GoTo ErrorFilllvLIST
Dim fn As Long, fNAME As String, l As String
Dim cNAME As String, cURL As String, itm As ListItem
fNAME = App.Path & "mem.dat"
If FileExists(fNAME) Then
fn = FreeFile
Open fNAME For Input As #fn
Do While Not EOF(fn)
Line Input #fn, l
cNAME = GetToken(l, "^")
cURL = l
Set itm = lvLIST.ListItems.Add(, , cNAME, , 1)
itm.SubItems(1) = cURL
Loop
Close #fn
End If
Exit Sub
ErrorFilllvLIST:
If fn <> 0 Then Close #fn
MsgBox Err & ":Error in call to FilllvLIST()." _
& vbCrLf & vbCrLf & "Error Description: " & Err.Description, vbCritical, "Warning"
Exit Sub
End Sub
Private Sub SaveList()
On Error GoTo ErrorSaveList
Dim itm As ListItem, f As Long
Dim fNAME As String
f = FreeFile
fNAME = App.Path & "mem.dat"
Open fNAME For Output As #f
For Each itm In lvLIST.ListItems
Print #f, itm.Text & "^" & itm.SubItems(1)
Next
Close #f
Exit Sub
ErrorSaveList:
MsgBox Err & ":Error in call to SaveList()." _
& vbCrLf & vbCrLf & "Error Description: " & Err.Description, vbCritical, "Warning"
Exit Sub
End Sub
Private Sub lvLIST_DblClick()
On Error Resume Next
Dim itm As ListItem, frm As frmData
Set itm = lvLIST.SelectedItem
If Not itm Is Nothing Then
Set frm = New frmData
frm.LoadIt itm.Text, itm.SubItems(1)
frm.Show
End If
End Sub
***************end of code************************
My question is do i need winsock to populate the list and if so can someone help me with it because i have never used winsock
Populate The Listview With Record And Set Full Row Select
I have problem here. How I can set the full row select for the first list of record in listview during the form load.
I have populate the record in the listview but it doen't set the full row select of the first record during form load. How I can set it?
Code:
On Error Resume Next
InfoRS.MoveFirst
Do Until InfoRS.EOF
Set lvItem = ListView1.ListItems.Add(, , "" & InfoRS.Fields("plot").Value & "") ' starting date
lvItem.ListSubItems.Add , , "" & (InfoRS.Fields("Pemilik1").Value & "") ' end date
lvItem.ListSubItems.Add , , "" & InfoRS.Fields("Pemilik2").Value & ""
lvItem.ListSubItems.Add , , "" & InfoRS.Fields("No_Ic").Value & ""
InfoRS.MoveNext
Loop
With ListView1
If .ListItems.Count > 0 Then
Set .SelectedItem = .ListItems(1)
.FullRowSelect = True
End If
End With
Populate ListView With All Folders Inside A Folder
I give up. I have searched Google, here, and planet source code for the last two hours trying to get some kind of head way. I'm fairly sure what I want to do is easy and probably has been answered before, but I guess I'm not using the correct keywords. Here's what I'm trying to do:
I'm writing up an app to update my WoW addons (I get sick of browsing the various UI sites to do this). What I need more than anything is a way to load all the addon folder names into a ListView.
Please help me, or point me in the direction of some answers.. Thanks.
How To Populate 2th,3th,4th Column Of Listview With Values From Functions?
Hi all i got the following code where Command7_Click,Command9_Click,Command12_Click output songname,artistname and album name to listboxes but what i want instead to output it in 2th,3th and 4th column of listview . Could any one show me how that can be done. I tried many things and it did not work. i have big time difficulty to make these work in parallel and i get all result in listview. I evantuall want to remove:
Command22_Click ' add songs to listview
Command15_Click ' add artistname and album name
to make things fullly automatic. I was thinking to have lesss functions and less buttons but i could not reduce it ! I will be happy if an expert help me fix the problems with these issues.Thanks
Note : Number of albumname and artist name should be repeated for the amount of songs i have in listbox
picture of my form
VB Code:
Private Sub RichTextBox2_Change() [b]'displays songnamesCommand7_Click[/b] '9 and 12 for albumname and artist name[b]Command9_Click 'albumname[/b][b]Command12_Click 'artist name[/b] '20 for removing empty row in listview for album nameCommand20_Click 'new calls i hope it workes Command22_Click ' add songs to listviewCommand15_Click ' add artistname and album name 'i put on click button code hereDim sResult() As String, N As LongDim lvwItem As ListItem If GetLine(RichTextBox2.Text, "pafiledb.php?action=file&id=", "&idP", sResult) Then For N = LBound(sResult) To UBound(sResult) sTemp = sResult(N) ' sTemp = Replace(sTemp, "pafiledb.php?action=file&id=3104", "") sTemp = Replace(sTemp, "pafiledb.php?action=file&id=", "pafiledb.php?action=download&id=") If InStr(sTemp, "pafiledb.php?action=download&id=3104") = 0 Then List2.AddItem "http://localhost/" & sTemp 'List2.AddItem "http://localhost/" & sTemp Text3.Text = Text3.Text & "http://localhost/" & sTemp & vbCrLf [b]Set lvwItem = ListView1.ListItems.Add(, , "http://localhost/" & sTemp)[/b] End If
'display songnames in listbox
VB Code:
[b]Private Sub Command7_Click()[/b]Dim sResult() As String, N As Long If GetLine2(RichTextBox2.Text, ">", "</a><br><a", sResult) Then For N = LBound(sResult) To UBound(sResult) [b]List3.AddItem "" & sResult(N)[/b] ===> i want to output to second column of listview Next N Else ' No occurances were found End If Label7.Caption = "Number of items: " & List3.ListCount 'Command22_Click End Sub Next N Else ' No occurances were found End If 'MsgBox "Number of items: " & List1.ListCount Label2.Caption = "Number of items: " & List2.ListCount Label8.Caption = "number of songs:" & ListView1.ListItems.Count End Sub
'shows albumname in listbox
VB Code:
[b]Private Sub Command9_Click()[/b]Dim sResult() As String, N As Long'Dim lvwItem As ListItem If GetLine2(RichTextBox2.Text, "top.document.title = '", "';", sResult) Then For N = LBound(sResult) To UBound(sResult) sTemp = sResult(N) sTemp = Replace(sTemp, "op.document.title = '", "") [b] List4.AddItem "" & sTemp[/b] ===> i want to output to 3th column of listview Next N Else ' No occurances were found End If Label7.Caption = "Number of items: " & List3.ListCount 'List4.ClearEnd Sub
'shows artist name in listbox
VB Code:
[b]Private Sub Command12_Click()[/b]Dim sResult() As String, N As Long If GetLine2(RichTextBox2.Text, ">", "</a> ::", sResult) Then For N = LBound(sResult) To UBound(sResult) sTemp = sResult(N) sTemp = Replace(sTemp, "Musik Main", "") [b] List5.AddItem "" & sTemp[/b]===> i want to output to 4th column of listview Next N Else ' No occurances were found End If 'Label7.Caption = "Number of items: " & List3.ListCount 'List5.ClearEnd Sub
'removes empty line from listbox
VB Code:
Private Sub Command20_Click()Dim N As LongFor N = List5.ListCount - 1 To 0 Step -1 If InStr(List5.List(N), "") = 0 Then List5.RemoveItem NNextEnd Sub
'adds songs to listview
VB Code:
Private Sub Command22_Click() For i = 1 To List2.ListCount ListView1.ListItems(i).SubItems(1) = List3.List(i - 1) 'ListView1.ListItems(i).SubItems(5) = List4.List(i - 1)Next i'List3.ClearEnd Sub
'adds albumname and artist name to listview
VB Code:
Private Sub Command15_Click()For i = 1 To List2.ListCount'For i = 1 To ListView1.ListItems.Count ListView1.ListItems(i).SubItems(2) = List5.List(0) ListView1.ListItems(i).SubItems(3) = List4.List(0)Next i End Sub
Populate Listview Tags With Winsock Control
lets say i have a listview filled with a few ip numbers.
what i would want to do with that list is, for every ip in the list, i would want to connect to each one in the list, send data and then put the recieved data into the corrasponding ip's listview tag... please help!!
Populate ListView Based On Search Criteria?
Hi,
I have the following:
1) Text file named Text.txt with the following data:
Blue Car
Red Car
Blue Truck
Red Truck
2) A form with a ListView (ListView1), Text box (Text1) and Command button (Command1).
Here's what I would like to accomplish. The ListView would not be populated until the user types in some text in the text box and hits the command button. The listview would then be populated with anything that matches the text entered into the text box. So using the above data, if the user entered bl in the search box, the listview would be populated with:
Blue Car
Blue Truck
Any ideas on how to accomplish this would be appreciated..
Dan
How To Fast Populate Listview From Microsoft Access?
Here is my code for populating listview from Microsoft Access.
Code:
Private Sub LookUp(SearchKey$)
Dim rsSearch As ADODB.Recordset
Dim strSearch As String
Dim ltmsearch As ListItem
DoEvents
'return textbox value
StatusBar1.Panels(1).Text = "Searching!!!"
SearchKey$ = Trim(SearchKey$)
'connect to database
OpenConnection
Set rsSearch = New ADODB.Recordset
strSearch = "SELECT * FROM TblPxList " & _
"WHERE " & lookupval & " like '" & SearchKey$ & _
"%' ORDER BY ID"
rsSearch.Open strSearch, adoc, adOpenDynamic, adLockOptimistic
rsSearch.Requery
If rsSearch.RecordCount = 0 Then
ctr = 0
rsSearch.Close
lvPxList.ListItems.Clear
StatusBar1.Panels(1).Text = "No record found for " & SearchKey$
Set rsSearch = Nothing
Exit Sub
ElseIf rsSearch.RecordCount >= 1 Then
lvPxList.ListItems.Clear
ctr = 0
Do Until rsSearch.EOF
ctr = ctr + 1
'lblRec.Caption = ctr
Set ltmsearch = lvPxList.ListItems.Add(, , rsSearch!Name)
ltmsearch.ListSubItems.Add , , rsSearch!Name
rsSearch.MoveNext
Loop
Set rsSearch = Nothing
Else
rsSearch.Close
Set rsSearch = Nothing
End If
StatusBar1.Panels(1).Text = " " & ctr & " " & "records found"
End Sub
Here is the scenario...
1. Im using Access with 30,000 + records and it's just 3 MB.
2. Im putting it on a network where everybody can access the program at the same time. Approximately 30-40 users it's just a small scale.
3. There is no "enter" button on the GUI. It is on textchange event. When they type, the listview will be populated every single letter.
The problem is, it's TOO SLOW. When I type the first letter, it took at least 1.5 second to populate.
Is there a way i can populate the listview faster? Or is there a technique in making database? 'coz I've seen a program with 60 MB access database and it searches fast.
Please give me an idea where to begin with. Thanks a lot in advance.
Quickest Way To Populate A Listview Control From An .ini File
My current methodology for populating a listview control from an .ini is very slow and i'm looking for suggestions on how to speed things up.(A couple thousand keys takes a good 5-10 seconds) My current structure involves running a for loop reading each key one at a time using GetPrivateProfileString. Maybe dumping the entire contents of the .ini into a buffer using GetPrivateProfileSection and parsing the data would be faster?
ListView, Double Click Event,populate Second Form Question.
Hi all:
I do not know how to do this, I have searched PlanetSourceCode.com for possible samples and have viewed over 150 threads on here for ListView and couldn't find anything that I could use.
This is the situation. (screen shots attached too)
I have my MySQL database attributes set as TEXT and it has six columns -- not including the id field which isnt going to be used here. (database.jpg)
When my ListView is populated, it looks like ListViewPopulated.jpg
What I am looking to do is, when you have selected a row from the ListView with the double click event, it takes the values of all three columns and places them into a select statement. With that select statement, it auto populates another form that has input fields and a drop down box. As you can see, the ListView has three of the attributes from the DB, those being of course date (BlogDate), time (BlogTime) and title (BlogTitle). I am looking to place the complete record from the database in the other form (BlogDate, BlogTime, BlogTitle, CurrentMood, BlogEntry) -- excluding Username and id. I do not know how to do this so if you can advise, it would be greatly appreciated. CurrentMood will of course be put into a drop down menu of some kind.
My ListView properties window looks like ListViewPropertiesWindow.jpg
If anyone can advise, it would be greatly appreciated.
How To Populate A ListView From A DB Adding Column Headings In Report Style?
I'm currently using ADO to connect to my DB. I want to populate a ListView(Report)with data from a table chosen from a CommonDial. but i don' know how to assign the ColumnHeadings as well as add the data. I want my program to be able to file out all the info in the ListView automaticaly once opened.(Tables I no nothing about?!?)
ListView And Tables
hey,
I am working on a code, that gets the field name in an access database and the vales under it and puts them all in a ListView Called LV1
the code is like this
Code:
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim strName As String
Dim strTableName As String
Dim strItemName As String
Dim x As Integer
strTableName = Combo1.List(Combo1.ListIndex) 'Here is the name of your Table
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & txtFile.Text & ";"
MyConn.Open
Set MyRecSet = MyConn.Execute("SELECT * FROM " & strTableName)
For x = 0 To MyRecSet.Fields.Count - 1
strName = MyRecSet.Fields.Item(x).Name
Set colx = LV1.ColumnHeaders.Add(, , strName) ', 700)
DoEvents
MyRecSet.MoveFirst
Do Until MyRecSet.EOF
strItemName = MyRecSet.Fields.Item(strName).Value
If x = 0 Then Set itmx = LV1.ListItems.Add(, , strItemName)
If x <> 0 Then itmx.SubItems(x) = strItemName
MyRecSet.MoveNext
DoEvents
Loop
Next x
the problem is in
Code:
If x <> 0 Then itmx.SubItems(x) = strItemName
its not putting it correctly in LV1, its starting putting the info from the buttom and keeps on overwritting it.
Please Help Anybody
Thanks
Listview And Multiple Tables?
Hi, this is my first thread and I'm pretty new to vb6.
At present I'm working on a search function using a listview.
Could someone tell me if there's a way to use multiple tables to populate the listview.
Heres my atttempt.
Private Sub Form_Load()
Call Connect
check_rs
rs.Open "select * from music", cnn
rsPub.Open "select * from Publishers", cnn
fill_list
End Sub
Public Sub fill_list()
ListView1.ListItems.Clear
If rs.RecordCount = 0 Then Exit Sub
While Not rs.EOF
Set lst = ListView1.ListItems.Add(, , rs(0))
For eX = 1 To 12
lst.SubItems(eX) = rs(eX)
Next eX
rs.MoveNext
Wend
End Sub
No joy though. Error 3265.
Listview Display From 2 Or More Tables.
Hello all,
I have a listview with 4 columns, Home, Away, Home score, Away score.
The data for Home & Away come from the table "Teams", the data for Homescore comes from the "HomeTeam" table and the data for Awayscore comes from the "Awayscore" table.
My question is how to set up the query so that the info can be displayed in the listview, respectively. I can get the "Home" team to display in the first column, but I don't know how to get the rest.
The query is also based on the selection of a date from the DTPicker.
I'll add the zip file if anyone wants to take a look at it.
If you don't understand what I'm trying to do, message me please.
Thanx in advance.
Cheers
Edited by - ziggy on 1/21/2003 3:47:10 PM
Displaying Records From Two Tables In Listview
hai everyone, I have two tables SD1 and PD.
SD1:
Stud_id,Fname etc
PD:
H_phone,Mobile,Stud_id(reference to SD1)
I want the records from both tables to be displayed in the listview while i enter the name of the student in Text box.
Code:
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim stud As String
Dim i As Byte
Module1.recordset("select Stud_id from SD1 where SD1.Fname Like " _
& " '" & Text1.Text & "" & "%'" & " ")
For i = 1 To rs.RecordCount
stud = rs(0)
Module1.RecordSet ("select DISTINCT SD1.Stud_id,SD1.Fname,PD.H_phone,PD.Mobile from SD1,PD where SD1.Fname Like " _
& " '" & Text1.Text & "" & "%'" & " AND PD.Stud_id Like " & " '" & stud & "" & "%'" & " ")
If rs.RecordCount <> 0 Then
Call FillListView(ListView1, rs)
Else
ListView1.ListItems.clear
End If
rs.MoveNext
Next i
End Sub
Sub FillListView(lv As ListView, rs As ADODB.RecordSet, Optional ImgNum As Long = 0)
lv.ListItems.clear
If Not rs.BOF Then
rs.MoveFirst
Dim a As Long
Dim lst As ListItem
While Not rs.EOF
'lst.Ghosted = True
Set lst = lv.ListItems.Add(, , rs.Fields(0).Value, , ImgNum)
For a = 1 To lv.ColumnHeaders.Count - 1
lst.SubItems(a) = rs.Fields(a).Value
Next
rs.MoveNext
Wend
End If
End Sub
Edit by Moderator:
Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.
Thank you.
[Read] Need Help With Custom Scrollbars On A Listview Control! Or Skinning Listview..
I have been searching for weeks now to find a way to use a custom scrollbar to scroll a listview...
Like this:
Now I use an alternating BG function on my listview and I am currently using the ensurevisible method of scrolling a listview...
Is there a better way?
I will post some example projects if needed...
But how would I use a custom scrollbar on a listview control
Thanks for helping
2 ListView Questions. 1 About Selecting Records. 2 About Adjusting Listview Box Size.
Hi,
I'm changing some of my programs to use a ListView instead of a ListBox.
1. On selecting a record how do I pass the info from the fifth column to another Sub? (I have .FullRowSelect = True)
2. I'm dynamically adjusting the column widths to the maximum length of the data going into the column. Is there a way to dynamically adjust the width of the listview box itself to be the sum of the column widths?
Thanks,
Al.
How To Compare 2 Listviews And Copy Listview Content To Another Listview?
Hi all. I am filling a listview with xml data as shown in code beleow. I am calling this part using timer.What i want at the end of this code to compare listview1 with listview2. If they are diffrent or if listview2 is empty then i copy content of listview1 to listview 2.Otherwise do nothing. could any one show me how i can make such compare an copy?Thanks
1 Code:
Dim objDoc As MSXML2.DOMDocument
Dim objNodelist As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Dim lvwItem As ListItem
'load the xml document
Set objDoc = New MSXML2.DOMDocument
objDoc.async = False
objDoc.Load "http://localhost/data.php"
'add all the song nodes into a nodelist
Set objNodelist = objDoc.selectNodes("//song")
'Clear the listview
ListView1.ListItems.Clear
'Loop through each song node and add to the list view
For Each objNode In objNodelist
Set lvwItem = ListView1.ListItems.Add(, , objNode.selectSingleNode("artist").Text)
lvwItem.SubItems(1) = objNode.selectSingleNode("name").Text
lvwItem.SubItems(2) = objNode.selectSingleNode("image").Text
lvwItem.SubItems(3) = objNode.selectSingleNode("rating").Text
lvwItem.SubItems(4) = objNode.selectSingleNode("songid").Text
lvwItem.SubItems(5) = objNode.selectSingleNode("totalvotes").Text
Next objNode
''Here i want to compare listview1 with listview2. If it is empty or diffrent if fill it
otherwise i do nothing.
Set lvwItem = Nothing
Set objNodelist = Nothing
Set objDoc = Nothing
|