gpt4 book ai didi

c# - 无法将类型 'string' 转换为 'float'

转载 作者:行者123 更新时间:2023-12-02 01:05:48 25 4
gpt4 key购买 nike

我收到这个错误:

Cannot convert type 'string' to 'float'

在以下代码行中:

float x=(float )(TextBox_item_price.Text);

我该如何解决这个问题?

最佳答案

你需要做的

float x = float.Parse(TextBox_item_price.Text);

关于c# - 无法将类型 'string' 转换为 'float',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22682695/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com