使用C#将int添加到textbox.text(int to textbox.text with C#)
使用VB我没有这个方法的错误
Private Sub But_Leer_Click(sender As Object, e As EventArgs) Handles But_Leer.Click Dim INT(3) As Integer ProEasy.ReadDevice32("LT4000_1.#INTERNAL", "Valor1", INT, 1) TextBox1.Text = INT(0)但是使用C#,在向Textbox1.text分配“Valor”int时出错。 需要一个字符串:
private void button2_Click(object sender, EventArgs e) { int[] Valor = new int[3]; ProEasy.ReadDevice32("LT4000_1.PLC1", "MWO", out Valor, 1); textBox1.Text = **Valor**[0];谁知道为什么? 我刚开始使用VB和C#语言
With VB I have no error with this method
Private Sub But_Leer_Click(sender As Object, e As EventArgs) Handles But_Leer.Click Dim INT(3) As Integer ProEasy.ReadDevice32("LT4000_1.#INTERNAL", "Valor1", INT, 1) TextBox1.Text = INT(0)But with C#, I have an error when assigning "Valor" int to Textbox1.text. A string is required:
private void button2_Click(object sender, EventArgs e) { int[] Valor = new int[3]; ProEasy.ReadDevice32("LT4000_1.PLC1", "MWO", out Valor, 1); textBox1.Text = **Valor**[0];Anyone knows why? I just starting with VB and C# language
最满意答案
Valor[0]返回int ,需要将其转换为string
textBox1.Text = Valor[0].ToString();Valor[0] returns int, you need to convert it to string
textBox1.Text = Valor[0].ToString();更多推荐
发布评论