对于下一个VB.NET,Power1值为零

编程入门 行业动态 更新时间:2024-10-12 12:33:55
本文介绍了对于下一个VB.NET,Power1值为零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

我尝试过: 你能帮我解决一下Power1 zerp问题。 我认为ctype在这里是不正确的。

What I have tried: Could you please help me to solve Power1 zerp issue. I think ctype is incorrect here.

推荐答案

稍微解释一下对你的问题有用... 我会做以下事情: - 而不是使用59个单独的变量(Guc1 ... Guc59)使用数组(Dim Guc(59) as decimal) 现在你可以索引循环中的每个Array-Element。 - 你真的很确定吗?每个文本框包含一个数值? 但是 - 你的代码看起来像这样: A little more explaining would be useful for your question ... I would do the following : - instead of using 59 seperate Variables (Guc1 ... Guc59) use an Array (Dim Guc(59) as decimal) now you are able to index each Array-Element inside your loop. - are you really sure that each Textbox contains a numeric value ? However - your code could look like this : Dim Guc (59) as decimal Guc(1) = Val(TextBox5.Text)*Val(Textbox98.Text) . . . Guc(59) = Val(TextBox42.Text)*Val(Textbox12.Text) For i = 1 To 59 Step 2 Dim txt As TextBox = CType(TabControlPanel1.Controls("TextBoxX" & i), TextBox) Hız1 = Val(txt.Text) * RollinRadius * 3.14 * 3.6 / (Val(TextBox1.Text) * Val(TextBox33.Text) * 30) Power1 = guc(i) * 3.14 / (30 * 1000) *2 *3) ' <== instead of 3.14 you could also use Math.Pi ListBox2.Items.Add(Power1) Next

附加: 如果你给你的文本框(以及其他控件)名称与输入相对应, ,你会更容易理解和阅读。 你认为,你会在几个月内知道哪些输入被制作成TextBox42(例如)?

Additional : If you give your Textboxes (and also other controls) names which correspond to the input, which is made into them, your will become much more understandable and readable. Do you think, that you will know in a few months which input is to be made into TextBox42 (for example) ?

更多推荐

对于下一个VB.NET,Power1值为零

本文发布于:2023-10-27 04:31:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532325.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:值为   VB   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!