单选题
假设在一个表单里有一个文本框Text1和一个命令按钮组CommamdGroup1。命令按钮组是一个容器对象,其中包含Command1和Commsnd2两个命令按钮。如果要在Command1命令按钮的某个方法中访问文本框的Value属性值,正确的语句是( )。
A) This.ThisForm.Text1.Value B) ThisParent.Parent.Text1.Value
C) ParentParent.Text1.Value D) ThisParent.Text1.Value
A
B
C
D
【正确答案】
B
【答案解析】
[解析] 本题要求在Command1的某个方法中访问文本框的Value属性值,应该选B)选项This.Parent.Parent.Text1.Value,其中This表示当前对象Command1;This.Parent表示当前对象Command1的父对象,即命令按钮组CommandGroup1;ThisParent.Parent表示命令按钮组的父对象,即表单;This.ParentParent.Text1.Value表示通过命令按钮Command1访问表单中的文本框的值。
提交答案
关闭