I want to use DBRadioGroup to display the database information Such as: DBRadioGroup have "paid" and "non-payment" two item When database PayState as "true" DBRadioGroup automatically check the "paid" Non-payment by the same token, Could you tell me how to implement this feature to?
CodePudding user response:
One, set DBRadioGroup binding data fields 1, DBRadioGroup binding field, should be a character type Such as: set the field name "payment" 2 and DBRadioGroup. The Items, the corresponding data fields, a list of string Such as: DBRadioGroup. Items, add "paid" and "non-payment" (design) can join) 3, the binding field Code: DBRadioGroup1. The DataSource:=aDataSource1; DBRadioGroup1. DataField:='payment; So, DBGrid, change, DBRadioGroup choice, follow the string field, and change (selected)
Second, judge selection operation code 1, if DBRadioGroup. Items [DBRadioGroup ItemIndex]='paid' Then the begin //do you have a payment code End The else begin If DBRadioGroup. Items [DBRadioGroup ItemIndex]='not paying' Then the begin //code executed your non-payment end; end;
2. Or: If dbradiogroup. Items [0]. Checked then... ;//payment If dbradiogroup. Items [1]. Checked then... ;//not paying