我目前使用在我的表单中动态创建的各种对象。由于是动态创建的,因此必须在创建对象之前声明它们。这给我留下了一长串变量,这些变量在我的项目编写中确实填满了我的数据字典。
我在下面列出了变量列表。有没有办法让我整理一下,例如在结构中?
也因为它们是公共变量,我想知道这段代码是否效率很低,以及如何改进它。
Public lblanswer As Label
Public txtQuestions(Qnum) As TextBox
Public lblQnumber(Qnum) As Label
Public cboQuestionType(Qnum) As ComboBox
Public txtMultichoice(Qnum * 4) As TextBox
Public txtShortAnswer(Qnum) As TextBox
Public btnTrue(Qnum), btnFalse(Qnum) As Button
Public btnSaveQuestions As Button
Public lblFileName As Label
Public txtFileName As TextBox
Public lblQType(Qnum) As Label
Public txtanswer(Qnum) As TextBox
Public truecheckbox(Qnum) As CheckBox
Public falsecheckbox(Qnum) As CheckBox
Public tickIcon, crossIcon As PictureBox
Public optTrue(Qnum), optFalse(Qnum) As RadioButton
Public grpTrueFalse(Qnum) As GroupBox
Public lblABCD(Qnum * 4) As Label
任何帮助将不胜感激。
谢谢。
你从哪里动态创建它,为什么?乍一看,您似乎不需要不同类型的对象。例如,您有 true 和 false 复选框,但这应该是一个单选按钮。您的文本框不同是有原因的?