運行程序後,我顯示Power1
的值爲零,爲什麼?Vb.Net值顯示下一個循環ctype爲零
這裏代碼;
Dim Guc1....Guc59 as decimal
Guc1=Val(TextBox5.Text)*Val(Textbox98.Text)
.
.
.
Guc59=Val(TextBox42.Text)*Val(Textbox12.Text)
For i = 1 To 59 Step 2
Dim txt As TextBox = CType(TabControlPanel1.Controls("TextBoxX" & i), TextBox)
Dim guc As Decimal = CType(("Guc".ToString & i), Decimal)
Hız1 = Val(txt.Text) * RollinRadius * 3.14 * 3.6/(Val(TextBox1.Text) * Val(TextBox33.Text) * 30)
Power1 = guc * 3.14/(30 * 1000) *2 *3)
ListBox2.Items.Add(Power1)
Next
正如一個側面評論,沒有一點要調用'「居奇」的ToString '。 ''Guc''已經是一個字符串了,所以在它上面調用'ToString()'沒有意義。 –