| 发表于:2007-05-11 17:19:28 楼主 |
option explicit dim a(45) as single private sub command1_click(index as integer) dim s as single on error resume next select case index case 0 if a(0) <= 0 or a(1) <= 0 or a(2) <= 0 or a(3) <= 0 then msgbox "数据输入有误! " exit sub else a(6) = a(4) * a(2) '1单价最小量 a(9) = a(7) * a(2) '2单价最小量 a(12) = a(10) * a(2) '3单价最小量 a(15) = a(13) * a(2) '4单价最小量 a(18) = a(13) * a(2) '5单价最小量 a(19) = 0.5 * a(5) * a(6) '存储费用1 a(20) = a(0) * a(1) / a(5) '订货费用1 a(21) = a(0) * a(4) '购物费用1 a(22) = a(19) + a(20) + a(21) '总成本1 a(24) = 0.5 * a(8) * a(9) '存储费用2 a(25) = a(0) * a(1) / a(8) '订货费用2 a(26) = a(0) * a(7) '购物费用2 a(27) = a(24) + a(25) + a(26) '总成本2 a(28) = 0.5 * a(11) * a(12) '存储费用3 a(29) = a(0) * a(1) / a(11) '订货费用3 a(30) = a(0) * a(10) '购物费用3 a(31) = a(28) + a(29) + a(30) '总成本3 text1(6).text = trim(a(6)) '1 text1(19).text = trim(a(19)) '存储费用1结果 text1(20).text = trim(a(20)) '订货费用1结果 text1(21).text = trim(a(21)) '购物费用1结果 text1(22).text = trim(a(22)) '总成本1结果 text1(9).text = trim(a(9)) '2 text1(24).text = trim(a(24)) '存储费用2结果 text1(25).text = trim(a(25)) '订货费用2结果 text1(26).text = trim(a(26)) '购物费用2结果 text1(27).text = trim(a(27)) '总成本2结果 text1(12).text = trim(a(12)) '3 text1(28).text = trim(a(28)) '存储费用3结果 text1(29).text = trim(a(29)) '订货费用3结果 text1(30).text = trim(a(30)) '购物费用3结果 text1(31).text = trim(a(31)) '总成本3结果 end if case 1 for s = 0 to 11 text1(s).text = " " if s < 2 then a(s) = 0 next case 2 end end select end sub private sub text1_change(index as integer) a(index) = val(text1(index).text) end sub 例如a(22)最小输出a(5),a(27)最小输出a(8),a(31)最小输出a(11) 我要text1(23).text输出 = |
|
|
|
|