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