補充:程式改了一下
把那50個文字框設為控制元件陣列(簡單的方法是先放一個文字框,然後複製它,貼上時它會提示你是否為控制元件陣列,選是就可以了,如此類推建立50個文字框)
另建一個text2文字框,建一個command button,在click事件裡寫程式碼如下:
private sub command1_click()
dim i as integer, total as double,strfomula as string
for i = 1 to 49 step 2
if text1(i) > "" and text(i+1) > "" then
total = total + val(text1(i)) * val(text1(i+1))
strfomula = strfomula & text1(i) & "X" & text1(i+1) & "+"
end if
next i
if right(strfomula,1) = "+" then strfomula = left(strfomula,len(strfomula)-1)
text2 = strfomula & "=" & total
end sub
補充:程式改了一下
把那50個文字框設為控制元件陣列(簡單的方法是先放一個文字框,然後複製它,貼上時它會提示你是否為控制元件陣列,選是就可以了,如此類推建立50個文字框)
另建一個text2文字框,建一個command button,在click事件裡寫程式碼如下:
private sub command1_click()
dim i as integer, total as double,strfomula as string
for i = 1 to 49 step 2
if text1(i) > "" and text(i+1) > "" then
total = total + val(text1(i)) * val(text1(i+1))
strfomula = strfomula & text1(i) & "X" & text1(i+1) & "+"
end if
next i
if right(strfomula,1) = "+" then strfomula = left(strfomula,len(strfomula)-1)
text2 = strfomula & "=" & total
end sub