andrey rodriguez
andrey rodriguez

Reputation: 11

the chechkbox keeps the last selected row

I have a form with a grid, the first column is not in the packages table, I added a checkbox. For example, if I select the second row in the checkbox, it stays selected even after closing the form.

enter image description here

The value of the checkbox is not stored in the table, how do I do it so that when the form is reopened the checkbox does not have any rows selected?

  SET PATH TO "C:\Users\ives\Documents\Visual FoxPro Projects\delivered\dbfs"

  USE IN 0 SHARED packages

  Thisform.packages.RecordSource = "packages"
  Thisform.packages.column2.ControlSource = "packages.code"
  Thisform.packages.column3.ControlSource = "packages.name"
  Thisform.packages.column4.ControlSource = "packages.address"
  Thisform.packages.column5.ControlSource = "packages.phone"
  Thisform.packages.refresh
  thisform.packages.setfocus()
  thisform.refresh 

The value that is configured in the check1.value is 0, after configuring the recordsource and the grid source control, I have this code but the problem continues.

Upvotes: 0

Views: 81

Answers (1)

Tamar E. Granor
Tamar E. Granor

Reputation: 3937

Every column in a grid has to have a ControlSource. If you're not specifying one, then the grid will choose one somewhere.

The typical way to use a checkbox in a grid for selection is to add a column to the table or cursor you're working with to hold that value, or to set up a cursor with a 1-1 relationship to your original table to hold the value.

Upvotes: 1

Related Questions