如何从其他表单访问控件的属性(被检查的单选按钮属性) [英] How do I access the property of a control (che checked property of a radiobutton ) from the other form

查看:75
本文介绍了如何从其他表单访问控件的属性(被检查的单选按钮属性)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是Marzieh。我一直在创建一个项目,但我不知道如何做其中的一部分。我在C#2010中创建了一个带有8个窗体的Windows窗体应用程序。第一个窗体是一个有4个按钮的窗体,如果我点击其中一个,第二个窗体将显示,第二个窗口有5个RadioButton,还有一个按钮,如果我点击第三个表格将显示的按钮,第三个表格就像第二个表格一样,其他的也是......除了最后一个表格。正好有一个文本框,

目标是应用程序:这是一个询问人们行为的项目,他们用RadioButtons回答,我想指定一个得分,用于选择以前表格中的每个RadioButton,并在最后一个表格的文本框中显示结果。我的问题是这部分.I无法连接表格的控制权......



我尝试过:



应用程序的目标:这个项目向人们询问他们的行为并用RadioButtons回答,我想指定一个分数,用于选择以前表单中的每个RadioButton并在文本框中显示结果在最后一个form.my问题是这部分。我无法连接表单的控件...

Hi I'm Marzieh.I have been creating a project,but I do not know how to do some part of it. I have created a windows form application in C# 2010 with 8 forms.the first one is a form that has 4 buttons,if I click on one of them the second form will show,the second one has 5 RadioButton and also a button,if I click on the button the third form will show,the third one is like the second one and the others too...except the last one.last one has a text box ,
the goal of the application : this a project that ask people about their behavior and they answer with the RadioButtons , I want to specify a score for choosing every RadioButton in previous forms and show the result in the textbox in the last form.my problem is this part.I can't connect the control of the forms...

What I have tried:

the goal of the application : this a project that ask people about their behavior and they answer with the RadioButtons , I want to specify a score for choosing every RadioButton in previous forms and show the result in the textbox in the last form.my problem is this part.I can't connect the control of the forms...

推荐答案

我不确定你是哪种方式我试图在您的表单之间传递信息,但其中一个应该有所帮助:

在两种形式之间传递信息,第1部分:父母对儿童 [ ^ ]

在两种形式之间转移信息,第2部分:儿童到父母 [ ^ ]

在两种表格之间传递信息,第3部分:儿童与儿童 [ ^ ]
I'm not exactly sure which way you're trying to pass info between your forms, but one of these should help:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]


WinForms中的每个控件都有一个 Modifiers 属性。默认情况下,此值为私有,但将其更改为公共内部将使控件对应用程序中的其他对象可见。然后,它只是将控件引用为表单的属性。

示例(使用VS默认命名为泛化):

Each control in WinForms has a Modifiers property. By default, this value is Private, but changing this to Public or Internal will make the control visible to other objects in your application. Then it is simply a matter of referencing the control as a property of the form.
example (using VS default naming here for generalisation):
Form1 form1 = new Form1();
bool isChecked = false;
if (form1.ShowDialog(this) == DialogResult.OK)
    isChecked = form1.checkbox1.Checked;


这篇关于如何从其他表单访问控件的属性(被检查的单选按钮属性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆