Loading data from recordset into TList1.Grid.Cells giving error

46 views
Skip to first unread message

Zifan

unread,
May 10, 2010, 7:42:13 AM5/10/10
to TList-DevelopersGroup
Hi...
I need help to to solve the follwing error occurs at the line I made a
commented description in the following code:
error is --> "Method 'Value' of Object 'ITListGridCell' failed"

anybody can help me to solve this..I'll be mo thankfull....

Private Sub Form_Load()
Dim rsJOS As New ADODB.Recordset
Dim CntJos As Integer
Dim i As Integer

TList1.Grid.Cols = 7

TList1.Grid.ShowColTitles = True
TList1.Grid.ShowRowTitles = True

'Specify width of columns in twips
TList1.Grid.ColDefs(0).Width = 600
TList1.Grid.ColDefs(1).Width = 2250
TList1.Grid.ColDefs(2).Width = 1050
TList1.Grid.ColDefs(3).Width = 1200
TList1.Grid.ColDefs(4).Width = 2250
TList1.Grid.ColDefs(5).Width = 1050
TList1.Grid.ColDefs(6).Width = 1200


'Specify fonts for heading cells
TList1.Grid.ColDefs(1).CellDef.Font.Bold = True
TList1.Grid.ColDefs(1).CellDef.Font.Size = 11
TList1.Grid.ColDefs(1).CellDef.Font.Name = "Arial"

TList1.Grid.ColDefs(2).CellDef.Font.Name = "Arial"
TList1.Grid.ColDefs(2).CellDef.Font.Size = 11
TList1.Grid.ColDefs(2).CellDef.Font.Bold = True
TList1.Grid.ColDefs(2).CellDef.Font.Italic = True

TList1.Grid.ColDefs(3).CellDef.Font.Bold = True
TList1.Grid.ColDefs(3).CellDef.Font.Size = 10
TList1.Grid.ColDefs(3).CellDef.Font.Name = "Arial"

TList1.Grid.ColDefs(4).CellDef.Font.Bold = True
TList1.Grid.ColDefs(4).CellDef.Font.Size = 10
TList1.Grid.ColDefs(4).CellDef.Font.Name = "Arial"

TList1.Grid.ColDefs(5).CellDef.Font.Bold = True
TList1.Grid.ColDefs(5).CellDef.Font.Size = 10
TList1.Grid.ColDefs(5).CellDef.Font.Name = "Arial"

TList1.Grid.ColDefs(6).CellDef.Font.Bold = True
TList1.Grid.ColDefs(6).CellDef.Font.Size = 10
TList1.Grid.ColDefs(6).CellDef.Font.Name = "Arial"

'Allow word wrapping for 1st column cells
'TList1.Grid.ColDefs(1).CellDef.MultiLine = 1

'Heading cells of grid:
TList1.Grid.Cells(0, 1).Value = "JOS No"
TList1.Grid.Cells(0, 1).CellDef.BackColor = RGB(255, 255, 0)
TList1.Grid.Cells(0, 2).Value = "Date"
TList1.Grid.Cells(0, 2).CellDef.BackColor = RGB(255, 0, 0)
TList1.Grid.Cells(0, 3).Value = "Ref No"
TList1.Grid.Cells(0, 3).CellDef.BackColor = RGB(0, 255, 255)
TList1.Grid.Cells(0, 4).Value = "Destination"
TList1.Grid.Cells(0, 4).CellDef.BackColor = RGB(0, 255, 255)
TList1.Grid.Cells(0, 5).Value = "Plant"
TList1.Grid.Cells(0, 5).CellDef.BackColor = RGB(0, 255, 255)
TList1.Grid.Cells(0, 6).Value = "Total Quantity"
TList1.Grid.Cells(0, 6).CellDef.BackColor = RGB(0, 255, 255)

''TList1.List(1) = "Main jet"
''TList1.ItemValues(1, VALUE_PRICE).Value = " 9"
''TList1.ItemValues(1, VALUE_ID).Value = 9874831

rsJOS.Open "SELECT * FROM JOSMaster", Conn, adOpenDynamic,
adLockOptimistic
i = 1
'With TList1.ItemGrid
With TList1.Grid
While rsJOS.EOF <> True
.Cells(i, 1).Value = rsJOS.Fields("JOSNo")
.Cells(i, 2).Value = rsJOS.Fields("Date")
.Cells(i, 3).Value = rsJOS.Fields("RefNo")
.Cells(i, 4).Value = rsJOS.Fields("Destination")
.Cells(i, 5).Value = rsJOS.Fields("PlantID")
.Cells(i, 6).Value = rsJOS.Fields("TotalQuantity") '// Giving
error ->Method 'Value' of Object 'ITListGridCell' failed
rsJOS.MoveNext
i = i + 1
Wend
End With

End Sub

ali zobi

unread,
Nov 20, 2012, 8:01:57 AM11/20/12
to tlist-deve...@googlegroups.com
hi,
did you handle the problem.
I m in trouble with tlist
an error give like yours and i can not handle.
What did you do to solve this problem.
 
best regards...

10 Mayıs 2010 Pazartesi 14:42:13 UTC+3 tarihinde Zifan yazdı:

Bennet-Tec Staff

unread,
Mar 15, 2013, 3:04:34 PM3/15/13
to tlist-deve...@googlegroups.com
       >          .Cells(i, 6).Value = rsJOS.Fields("TotalQuantity")
       >               '// Giving error ->Method 'Value' of Object 'ITListGridCell' failed
 
The problem is probably that you are trying to assign the field,
when you should be assigning the value held in the field.
 
Try
             .Cells(i, 6).Value = rsJOS.Fields("TotalQuantity").value
 
If this does not work try
                  x =  rsJOS.Fields("TotalQuantity").value
                  .Cells(i, 6).Value  = x
This should help to isolate the problem.
 
Reply all
Reply to author
Forward
0 new messages