Im currently filling a tdbgrid with an array formed from a table.Im then adding new records to the table by adding new lines to the grid and writing these to the table.
I need to lock all rows that get read into the grid but NOT the new ones im creating.
Im trying currently to use the fetchrowstyle function and then
rowstyle.locked = true but cant get the correct rows to lock.
The code currently looks like this.
aryprocessorder.ReDim 0, rstprocessorderdetails.RecordCount - 1, 0, 8
intloop = 0
Do While rstprocessorderdetails.EOF = False
If IsNull(rstprocessorderdetails!ProcessOrderNumber) Then ProcessOrderNumber = "" Else ProcessOrderNumber = LTrim(rstprocessorderdetails!ProcessOrderNumber)
If IsNull(rstprocessorderdetails!product) Then product = "" Else product = LTrim(rstprocessorderdetails!product)
If IsNull(rstprocessorderdetails!productionDate) Then productionDate = "" Else productionDate = LTrim(rstprocessorderdetails!productionDate)
If IsNull(rstprocessorderdetails!batchpalletnumber) Then batchpalletnumber = "" Else batchpalletnumber = LTrim(rstprocessorderdetails!batchpalletnumber)
If IsNull(rstprocessorderdetails!uniquepalletnumber) Then uniquepalletnumber = "" Else uniquepalletnumber = LTrim(rstprocessorderdetails!uniquepalletnumber)
If IsNull(rstprocessorderdetails!line) Then lineid = "" Else lineid = LTrim(rstprocessorderdetails!line)
If IsNull(rstprocessorderdetails!quantity) Then quantity = "" Else quantity = LTrim(rstprocessorderdetails!quantity)
aryprocessorder(intloop, 0) = ProcessOrderNumber
aryprocessorder(intloop, 1) = product
aryprocessorder(intloop, 2) = productionDate
aryprocessorder(intloop, 3) = batchpalletnumber
aryprocessorder(intloop, 4) = uniquepalletnumber
aryprocessorder(intloop, 5) = lineid
aryprocessorder(intloop, 6) = quantity
aryprocessorder(intloop, 7) = "Y" ' this is the flag that i use to determine if a record is new or has been read in
If aryprocessorder(intloop, 7) = "Y" Then
flag = "Y"
Else
flag = ""
End If
intloop = intloop + 1
rstprocessorderdetails.MoveNext
Loop
TDBGrid1.Array = aryprocessorder
TDBGrid1.ReBind
TDBGrid1.MoveLast
End Sub
Private Sub tDBGrid1_FetchRowStyle(ByVal Split As Integer, Bookmark As Variant, ByVal RowStyle As TrueDBGrid60.StyleDisp)
If flag = "Y" Then
RowStyle.Locked = True
Else
RowStyle.Locked = False
End If
End Sub
I need to lock all rows that get read into the grid but NOT the new ones im creating.
Im trying currently to use the fetchrowstyle function and then
rowstyle.locked = true but cant get the correct rows to lock.
The code currently looks like this.
aryprocessorder.ReDim 0, rstprocessorderdetails.RecordCount - 1, 0, 8
intloop = 0
Do While rstprocessorderdetails.EOF = False
If IsNull(rstprocessorderdetails!ProcessOrderNumber) Then ProcessOrderNumber = "" Else ProcessOrderNumber = LTrim(rstprocessorderdetails!ProcessOrderNumber)
If IsNull(rstprocessorderdetails!product) Then product = "" Else product = LTrim(rstprocessorderdetails!product)
If IsNull(rstprocessorderdetails!productionDate) Then productionDate = "" Else productionDate = LTrim(rstprocessorderdetails!productionDate)
If IsNull(rstprocessorderdetails!batchpalletnumber) Then batchpalletnumber = "" Else batchpalletnumber = LTrim(rstprocessorderdetails!batchpalletnumber)
If IsNull(rstprocessorderdetails!uniquepalletnumber) Then uniquepalletnumber = "" Else uniquepalletnumber = LTrim(rstprocessorderdetails!uniquepalletnumber)
If IsNull(rstprocessorderdetails!line) Then lineid = "" Else lineid = LTrim(rstprocessorderdetails!line)
If IsNull(rstprocessorderdetails!quantity) Then quantity = "" Else quantity = LTrim(rstprocessorderdetails!quantity)
aryprocessorder(intloop, 0) = ProcessOrderNumber
aryprocessorder(intloop, 1) = product
aryprocessorder(intloop, 2) = productionDate
aryprocessorder(intloop, 3) = batchpalletnumber
aryprocessorder(intloop, 4) = uniquepalletnumber
aryprocessorder(intloop, 5) = lineid
aryprocessorder(intloop, 6) = quantity
aryprocessorder(intloop, 7) = "Y" ' this is the flag that i use to determine if a record is new or has been read in
If aryprocessorder(intloop, 7) = "Y" Then
flag = "Y"
Else
flag = ""
End If
intloop = intloop + 1
rstprocessorderdetails.MoveNext
Loop
TDBGrid1.Array = aryprocessorder
TDBGrid1.ReBind
TDBGrid1.MoveLast
End Sub
Private Sub tDBGrid1_FetchRowStyle(ByVal Split As Integer, Bookmark As Variant, ByVal RowStyle As TrueDBGrid60.StyleDisp)
If flag = "Y" Then
RowStyle.Locked = True
Else
RowStyle.Locked = False
End If
End Sub