Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking rows in a TDBGRID

Status
Not open for further replies.

garethn

Programmer
Jul 3, 2001
12
GB
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top