如何存储和检索从Winforms Devexpress到MS Access数据库的功能区控件的RadioGroup单选按钮和复选框? [英] How to store and retrieve the RadioGroup Radio Button and CheckBox of Ribbon Control from Winforms Devexpress to MS Access Database?
问题描述
在我的表单中,我使用了Ribbon控件,因为RadioGroup用于计算。现在我需要存储表单的内容,如果我在Gridview中单击,则要将其取回。我可以存储和检索textedit,查找编辑和检查外面的Ribbon控件。如何从Ribbon控件中存储和检索RadioGroup?
In my form I used Ribbon control in that RadioGroup is used for calculations. Now I need to store content of form and want to retrieve it back if I click in Gridview. I can able to store and retrieve textedit, lookup edit and checkedit outside Ribbon Control. How to store and retrieve the RadioGroup from Ribbon Control ??
存储CheckBox的示例我使用此代码
example for storing CheckBox I used this code
bool temp = barCheckItem1.Checked;
在Access数据库中使用是/否数据类型进行存储。
对于检索使用此代码
In Access Database used "Yes/No" Data Type to store. For retrieve used this code
barCheckItem1.Checked = reader.GetBoolean(2);
此代码对CheckBox有效,但我需要存储RadioButton RadioGroup。如何存储&检索它?帮我。感谢Advance。
this code work fine for CheckBox but I need to Store RadioButton RadioGroup. How to Store & Retrieve it ?? Help me. Thanks in Advance.
推荐答案
只需存储 barEditItem.EditValue
在 RadioButton
中选择项目。
Just store barEditItem.EditValue
which is the selected item in the RadioButton
.
我假设你有 int
as EditValue
从您以前的问题。所以这应该是足够的。
I assume you have int
as EditValue
from your previous question. So this should be enough.
int selectedItem = (int)barEditItem.EditValue;//To Store
将所选项目存储在数据库中
Store the selected item in DB
barEditItem.EditValue = reader.GetInt32(index);//To retrieve back
这篇关于如何存储和检索从Winforms Devexpress到MS Access数据库的功能区控件的RadioGroup单选按钮和复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!