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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
ListView Select Full Row (SP2)
Is there any way to select full row in Listview in Microsoft Windows common control SP2 i know u can use the fullrowselect = true in common control 6.0 but the thing is only VB5 contro;s can be viewed in XP style in winXp and 6.0 can not be viewed in XP style look
ListView Full Row Select?
I could've sworn there was a way to enable a full row select in the VB ListView? Or am I just going crazy? I can't seem to find the property to set...
Any help would be appreciated..
Dan
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...:
Populate Record
I use combo box, textbox and the record store in dbf file. I have field name 'Area' .I like to do like this, When I select the field name 'Area' using drop down menu, and start do searching record of the particular field by typing the text in the text box,It populate the list of record for that field. The idea is, How to do like the example below?Any Idea how to start work with it?
Select Row From Each Table And Populate?
Hi Folks,
Now this is probably a very dumb question but I am new to VB. I am trying to have 2 active tables using a datagrid for each and need to select/highlight a row of one and select/highlight row in the other. With both selected I will hit a command button and a field from the row selection in one table will be populated in the other table's database.
Would anyone have a basic example to get me started down the right path. Example: Lets say we have a job row in a table table and need to add a persons name from the row selection of the other table.
Thanks very much in advance,
Dave
Mshflexgrid Full Row Select With Focus
I am actully after the effect you get with listview with FullRow Select with setfocus.
Want the entire row to be highlited with focus.
Got part of it then lost it all. Has to be a simple call that I have missed.
Full Row Select Of List View
Hi,
How can I force full row select of a list view?
I know listviews come with a property called "FullRowSelect" but it is not available in my list view's properties.
Populate A Record In Msgbox Help
I'm having problem on populate a record in msgbox using this code:
Code:
Sub A()
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
Rs.Open "SELECT * FROM stock where productid='" & txtkodebarang.Text & "'", con_Data, adOpenStatic, adLockReadOnly, adCmdText
Dim intRecord As Integer
If Rs.EOF Then
MsgBox "No data found!"
Else
Rs.AbsolutePage = 2
For intRecord = 1 To Rs.PageSize
MsgBox Rs.Fields("box_0").Value ' ????
Rs.MoveNext
If Rs.EOF Then Exit For
Next intRecord
End If
Rs.Close
Set Rs = Nothing
End Sub
Code:
Private Sub txtKodeBarang_LostFocus()
call A
end sub
"Run time error Either BOF or EOF is true, or current record has been deleted, requested operation requires a current record"
When I debug :
rs.fields = <Either BOF or EOF is true, or current record...>
("box_0").value = <Either BOF or EOF is true, or current record...>
I have looking at database FAQ but still can't fix the problem, Anyone can help is greatly appreciated. Thanks
Regards,
Cesin
Populate A Record Set From 2 Connections
I need to populate one record set from two different connections
e.g.
connection1.adodb.connection Path = c:folder1
connection2.adodb.connection Path = c:folder2
in each connection there are database tables with identical layout
each folder contains data collected from different locations
I need to combine the data in one recordset
rs2.adodb.recordset
rs2.open "select * from table" , connection1
<Ammend rs2> rs2.open "select * from table" , connection2
I know that the above isn't code, but only to show what I need. My question is, Is it possible to do? and how?
Thank You
Populate More Than 1 Record In Flexgrid
hi all,
if i have more than 1 record to display in flexgrid, how should i do?
i really have no idea what should i code if have more than 1 record to display.
Please help.
thanks
rgds
Prompt = "Input batch to receive"
SearchStr = InputBox(Prompt, "Batch Search")
With rsLots
.ActiveConnection = cnsql
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "Select * from batch_tab where sbatch ='" & SearchStr & "'"
End With
rsLots.MoveFirst
Do While Not rsLots.EOF
MSFlexGrid1.TextMatrix(0, 0) = "Batch"
MSFlexGrid1.TextMatrix(0, 1) = "Item Number"
MSFlexGrid1.TextMatrix(0, 2) = "Quantity"
MSFlexGrid1.TextMatrix(0, 3) = "Select"
MSFlexGrid1.TextMatrix(1, 0) = rsLots.Fields("sbatch")
MSFlexGrid1.TextMatrix(1, 1) = rsLots.Fields("sitemnumber")
MSFlexGrid1.TextMatrix(1, 2) = rsLots.Fields("sqty")
MSFlexGrid1.TextMatrix(1, 3) = "CA"
rsLots.MoveNext
Loop
rsLots.Close
How Do You Populate A DataGrid From A Record Set?
Hi, I've built a recordset with the various info that i need...i now want my data grid to populate with the info from this rs when i click on the view button.....
currently when i click on the view button, nothing happens - the grid stays empty...
are they more difficult to work with than I originally thought?!
Populate Record Into Form
Hi , i wonder how do i populate records into form in VBA ?
I want to set formname into recordset so that i can transfer data from recordset into the form. Any idea?
Populate Variable With A Select Statement
My code:
Code:
Dim VConn As ADODB.Connection
Set VConn = New ADODB.Connection
Dim strZipCode As Variant
VConn.ConnectionString = "Provider=MSDAORA.1;Password=sysadm;User ID=sysadm;Data Source=test;Persist Security Info=True"
VConn.Open
strZipCode = VConn.Execute("SELECT Zipcode from Customer WHERE ID = '7777777'")
Debug.Print strZipCode
-----------------------------------------
Here's my problem:
With the strZipCode variable set as a Variant, the Debug line of code returns error #450 - "Wrong number of arguments or invalid property assignment".
With the strZipCode variable set as a String, the Debug line of code returns a compile error - "Type mismatch".
According to our databases' (Oracle 8.05) Data Dictionary, the Zipcode field in the SELECT statement is a VARCHAR variable type.
How can I get the Zipcode from the SELECT statement to be assigned to the strZipCode variable without the errors?
Thanks for the help.
Want To Populate A Datagrid With A Select Stmt.
Hello, I'm looking for a way to display some information from a select stmt, 3 coloumns using a recordset.
I tried to do this with a data grid:
dgdOne.DataSource = adoRecord.open"select col1, 2, 3 from table", DB,static,pessimistic
It doesnt work.
I know that you need to connect to the DB with a data control and then set the datagrids datasource to point to it, but I dont want to do this.
i guess I'm looking for a built in vb6 control that will display my query results in columns, and look nice too. ie no lstboxes with dashes separating the coloums.
Any suggestions?
How Can A Record Set Be Used To Populate A Dbgrid Control.
How can a record set be used to populate a dbgrid control.
My code is
Dim rs As Recordset
Dim db As Database
...
...
Set rs = db.OpenRecordset(strQuery, dbOpenDynaset)
I need to display the records returned in rs onto the grid???
Regards
Aswin Asokan
HELP ME SELETING RECORD BETWEEN TWO DATE ..i Have Given What I Did Full Code...
HI.....i got problem for Seleting record Between Two date.......i did like this ..but its not working...its telling that Syntex error(missing oprator)....any one can help me.....here i have given full code what i did.....and also i want to insert all the record in to another table.......any one can help me......(with MSFLEXGRID data).....plz help me....
Code:
Option Explicit
Dim rscmbLoad As ADODB.Recordset
Dim rs As ADODB.Recordset
Dim c As Integer
Dim r As Integer
Dim orno As String
Dim SalesTotal As Double
Dim SalesNetAmount As Double
Dim SalesDiscount As Double
Dim I As Integer
Private Sub cmdShow_Click()
If cmb_Company.CausesValidation = True Then
Set rs = New ADODB.Recordset
orno = cmb_Company.Text
sqlQry = "select * from Invoice where Inv_Company_Name='" & (cmb_Company.Text) & "'And Between (Inv_Date>=Format('" & dtp_Fdate.Value & "', 'DD/MM/YYYY') Inv_Date<=Format('" & dtp_Tdate.Value & "', 'DD/MM/YYYY'))'"
rs.Open sqlQry, cConnection, adOpenKeyset, adLockOptimistic
FlxGrdDemo.Rows = 1
FlxGrdDemo.Cols = rs.Fields.Count
ReDim col_wid(0 To rs.Fields.Count - 1)
For c = 0 To rs.Fields.Count - 1
FlxGrdDemo.TextMatrix(0, c) = rs.Fields(c).Name
col_wid(c) = TextWidth(rs.Fields(c).Name)
Next c
SalesTotal = 0
FlxGrdDemo.Rows = 1
With FlxGrdDemo
If Not (rs.BOF And rs.EOF) Then
.Rows = 1
Do Until (rs.EOF)
.AddItem rs("Invoice_No") & Chr(9) _
& rs("Inv_Date") & Chr(9) _
& rs("Inv_Do_Number") & Chr(9) _
& rs("Inv_Vehicle_Number") & Chr(9) _
& rs("Inv_Company_Name") & Chr(9) _
& rs("Inv_Place") & Chr(9) _
& rs("Inv_Charges") & Chr(9) _
& rs("Inv_Others") & Chr(9) _
& rs("Inv_Others_Charges") & Chr(9) _
& rs("Inv_Quantity") & Chr(9) _
& rs("Inv_PerPrice") & Chr(9) _
& rs("Inv_Goods") & Chr(9) _
& Format(rs("Inv_Total_Amount")) & Chr(9)
SalesTotal = SalesTotal + rs("Inv_Total_Amount")
rs.MoveNext
.ColAlignment(1) = flexAlignLeftCenter
Loop
End If
End With
End If
' Display the values for each row.
r = 1
Do While Not rs.EOF
FlxGrdDemo.Rows = FlxGrdDemo.Rows + 1
For c = 0 To rs.Fields.Count - 1
FlxGrdDemo.TextMatrix(r, c) = _
rs.Fields(c).Value
Next c
rs.MoveNext
r = r + 1
Loop
' Close the recordset and connection.
rs.Close
' Set the column widths.
For c = 0 To FlxGrdDemo.Cols - 1
FlxGrdDemo.ColWidth(c) = col_wid(c) + 1000
Next c
Text1.Text = Format(SalesTotal, "0.00")
'End If
End Sub
Private Sub FlxGrdDemo_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyReturn
' When the user hits the return key
' this code'll move the next cell or row.
With FlxGrdDemo
If .Col + 1 <= .Cols - 1 Then
.Col = .Col + 1
ElseIf .Row + 1 <= .Rows - 1 Then
.Row = .Row + 1
.Col = 0
Else
.Row = 1
.Col = 0
End If
End With
Case vbKeyBack
' Delete the previous character when the
' backspace key is used.
With FlxGrdDemo
If Trim(.Text) <> "" Then _
.Text = Mid(.Text, 1, Len(.Text) - 1)
End With
Case Is < 32
' Avoid unprintable characters.
Case Else 'Else print everything
With FlxGrdDemo
.Text = .Text & Chr(KeyAscii)
End With
End Select
End Sub
Private Sub FlxGrdDemo_KeyUp(KeyCode As _
Integer, Shift As Integer)
Select Case KeyCode
' Copy
Case vbKeyC And Shift = 2 ' Control + C
Clipboard.Clear
Clipboard.SetText FlxGrdDemo.Text
KeyCode = 0
' Paste
Case vbKeyV And Shift = 2 'Control + V
FlxGrdDemo.Text = Clipboard.GetText
KeyCode = 0
' Cut
Case vbKeyX And Shift = 2 'Control + X
Clipboard.Clear
Clipboard.SetText FlxGrdDemo.Text
FlxGrdDemo.Text = ""
KeyCode = 0
' Delete
Case vbKeyDelete
FlxGrdDemo.Text = ""
End Select
End Sub
Private Sub Form_Load()
With FlxGrdDemo
.ColWidth(0) = 1000
.ColWidth(1) = 1000
.ColWidth(2) = 1000
End With
'Call fillgrid
Set rscmbLoad = New ADODB.Recordset
sqlQry = "SELECT * FROM Invoice"
rscmbLoad.Open sqlQry, cConnection, adOpenKeyset, adLockOptimistic
cmb_Company.Clear
ComboFill cmb_Company, rscmbLoad, "Inv_Company_Name", "Invoice_No"
Inv_Bill_Date.Value = Format(Now, "DD/mm/yyyy")
dtp_Fdate.Value = Format(Now, "DD/mm/yyyy")
dtp_Tdate.Value = Format(Now, "DD/mm/yyyy")
End Sub
Public Sub fillgrid()
FlxGrdDemo.Row = 0
FlxGrdDemo.Col = 0
FlxGrdDemo.ColWidth(1) = 500
FlxGrdDemo.Text = "Invoice No"
FlxGrdDemo.Col = 1
FlxGrdDemo.Text = "Date"
FlxGrdDemo.Col = 2
FlxGrdDemo.Text = "Vehicle No"
FlxGrdDemo.Col = 3
FlxGrdDemo.Text = "Place "
FlxGrdDemo.Col = 4
FlxGrdDemo.Text = "Charge"
FlxGrdDemo.Col = 5
FlxGrdDemo.Text = "Others"
FlxGrdDemo.Col = 6
FlxGrdDemo.Text = "O.Charges"
FlxGrdDemo.Col = 7
FlxGrdDemo.Text = "Quantity"
FlxGrdDemo.Col = 8
FlxGrdDemo.Text = "Unit Price"
FlxGrdDemo.Col = 9
FlxGrdDemo.Text = "Goods Type"
FlxGrdDemo.Col = 10
FlxGrdDemo.Text = "Total Amount"
End Sub
Private Sub Text2_Change()
Text3.Text = (Val(Text1.Text)) - ((Val(Text2.Text) * Val(Text1.Text)) / 100)
End Sub
plz help me.....
Dont Know How To Select Dat From Combo Box And Populate Datagrid Using
pleaseeeeeeeeeeeee help past 3 days i am goin crazy my prob is i want to populate the data grid based on thesselection from combo box the combo1.text is a parameter to a query that says select * from labour where skillname=?
i have tried data environment i have managed to write this query in access but i dont know how to bring this query into vb
thanx to anyone who helps
VB6 MshFlexGrid Select Full Row Problem (even With FlexSelectionByRow Enabled)
Hello all
I've been having numerous difficulties with showing a full row on a MSHFlexGrid as being selected. This has come up on several grids i have developed.
I want users to be able to select one record and only one record at any given time. When they click on a record, it should highlight the whole row and not just part of it.
This is a problem of formatting and presentation - it looks awful when the user clicks a row and only part of it goes blue. Sometimes it is only the left-most cell that stays white.
On one grid, when the user uses a keyboard shortcut to activate the grid control, only columns 4 onwards are highlighted on the selected row, even if the user uses the cursor keys to move up and down. Puzzlingly, if a row is selected with the mouse, the full row is highlighted.
The properties of the grids that i have set are:
RowSizingMode - flexRowSizeIndividual
SelectionMode - flexSelectionByRow
Highlight - flexHighlightAlways
Redraw - True
AllowBigSelection - False
FixedRows - varied, no change to results
FixedCols - varied, no change to results
Is there any hard and fast way to ensure that a row clicked on a MSHFlexGrid will be highlighted in its entirety, no matter how many columns or rows it has, by setting any of the above attributes or any other ones?
many thanks
Get Max Record From Current Project And Populate Textbox
Hi:
This code produces a record member or data not found error. I'm so confused. I get the max value for the autonumber, then do a selection based on the max criteria, then set Me.txtRevision.Value. This is where the error orrurs. I've used recordsets before, so I am so confised. All I want to do is populate a textbox with the value of the four fields in the table.
BTW: I ran all these queries manually with no problem.
Thanks in avdance for the help, if you would be so kind to hit me over the head!
Code:
Private Sub Form_Load()
' Establish Revision Documentation
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT MAX(PK) as EXPR1000 FROM tblRevision ", CurrentProject.Connection, adOpenStatic, adLockOptimistic
Dim max As Long
max = rs.Fields("EXPR1000")
rs.Close
Set rs = Nothing
Dim rs1 As ADODB.Recordset
Set rs1 = New ADODB.Recordset
Dim sql As String
sql = "SELECT tblRevision.PK, tblRevision.Revision, tblRevision.Date, tblRevision.Comment " & _
"FROM tblRevision " & _
"WHERE (((tblRevision.PK) = " & max & ")); "
MsgBox ("sql: " & sql)
rs1.Open sql, CurrentProject.Connection, adOpenStatic, adLockOptimistic
Me.txtRevision.Value = "Revision: " & rs1.Fields("Revision") & "Date: " & Str(rs1.Fields("Date")) & " - " & rs1.Fields("Comment")
rs1.Close
Set rs1 = Nothing
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.
Populate A Field Based A Record Number
Hi all,
I have a master detail form Orders / Order Details. When I enter an order number in my main form the value is carried in to my detail form (this is the link) OrderId. I then want to enter more than 1 record in my details form but I want the details records to have a unique Id. I have called this field Line Number. I can do this quite easily with an AutoNumber field but I would like this fields value to be based on how many detail records i actually enter for the main order. eg:
Main form - Order Number 10
Detail Form - Order number 10 line 1
Detail Form - Order number 10 line 2
Main form - Order Number 11
Detail Form Order Number 11 line 1
Detail Form - Order number 11 line 2
As you can see the line number needs to start at 1 every time a new Master record is added and the line number field needs to be based on how many datail records there are.
I am using access2000 as my database.
Hope I have explained myself??? Hope someone can help
Thanks in advance
Franki
Populate Textbox Based On Record Selected In Combo
Hello, I have a form where the user is entering appointment details. I have a client table in an access db and its linked up an everything.
The first item on the form is a client combobox. Based on which client the user selects, I wish to show the corresponding client number in a text box which is the next item on the form.
Any help would be great
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.
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 Get The Full Text From A Listview Using API? [*Unresolved*]
when using
Call SendMessageByString(lngTree, LB_GETTEXT, lngIndexOfMail, strMails)
to get text from a listview, i can retrieve the text of the entire row, but only the data that is being shown..
if the listview columns are shortened, i can only retrieve the text that is shown
how can i get the full text?
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
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>
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 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 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?
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!
|