不明白这个vb程序中为什么有AddLabel = "",还有下边addlabel()中每部分的作用和意思?

Function AddLabel(name As String, caption As String, i As Integer) As String
Dim myLabel As Label
Set myLabel = Me.Controls.Add("vb.Label", name)
myLabel.caption = caption
myLabel.BackStyle = 0
myLabel.Visible = True
myLabel.Top = 900 * (StudentIndex - 1) + i * 200
myLabel.Width = 6000
AddLabel = ""
End Function
Dim a As String
a = AddLabel("label" + CStr(StudentIndex) + "Sorce1", "Data_Array(" + CStr(StudentIndex) + ",1)=" + CStr(Sorce_arry(StudentIndex).Sorce1), 1)
a = AddLabel("label" + CStr(StudentIndex) + "Sorce2", "Data_Array(" + CStr(StudentIndex) + ",2)=" + CStr(Sorce_arry(StudentIndex).Sorce2), 2)
a = AddLabel("label" + CStr(StudentIndex) + "Sorce3", "Data_Array(" + CStr(StudentIndex) + ",3)=" + CStr(Sorce_arry(StudentIndex).Sorce3), 3)
a = AddLabel("label" + CStr(StudentIndex) + "Sorce4", "Data_Array(" + CStr(StudentIndex) + ",4)=" + CStr(Sorce_arry(StudentIndex).Sorce4), 4)
StudentIndex = StudentIndex + 1

第1个回答  2013-06-28
相当于给函数一个空返回值。
后面的AddLabel调用在窗体上创建了4个Label控件:
name属性 caption属性 Top属性
label[]Sorce1 Data_Array([],1)={} 900*([]-1)+200
label[]Sorce2 Data_Array([],2)={} 900*([]-1)+400
label[]Sorce3 Data_Array([],3)={} 900*([]-1)+600
label[]Sorce4 Data_Array([],4)={} 900*([]-1)+800
其中[]=Cstr(studentindex),{}=CStr(Sorce_arry(StudentIndex).Sorce1)~CStr(Sorce_arry(StudentIndex).Sorce4)
相似回答
大家正在搜