将文本框数据转换为整数

时间:2015-09-22 05:40:49

标签: visual-studio-2010 textbox typecasting-operator

我正在尝试在textbox&中输入值我想转换为整数。我正在使用VBA 2013。

我尝试了多种方式,但我一直都在接受预期

Rated_current = CInt(Int(TextBox_RatedCurrent.Text))

Rated_current = CInt(TextBox_RatedCurrent.Text)

Rated_current = Convert.toInt32(TextBox_RatedCurrent.Text)

Private Sub TextBox_Bmax_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Bmax.TextChanged

    Rated_current = CInt(Int(TextBox_RatedCurrent.Text))
    Mod_current = TextBox_RatedCurrent.Text * TextBox_TotalDrate.Text
    Calculated_TempRise.Text = CInt(Max_temp / ((Log10(Mod_current) / Log10(Rated_current)) * 1.64))
End Sub

1 个答案:

答案 0 :(得分:0)

在V2013 c#

中尝试此操作
int Rated_current;
bool check = int.tryParse(TextBox_RatedCurrent.Text,out Rated_current);
if(!check)
{

//Incoming value is wrong

}