窗口表单应用程序中的错误 [英] error in window form application

查看:80
本文介绍了窗口表单应用程序中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法将类型'string'转换为System.Windows.Forms.Textbox

cannot implicity convert type 'string' to System.Windows.Forms.Textbox

推荐答案

Quote:

无法将类型'string'转换为System.Windows.Forms.Textbox

cannot implicity convert type 'string' to System.Windows.Forms.Textbox

很明显,您正在尝试分配字符串直接到 TextBox ,但你应该将其分配给 TextBox.Text 属性。

It is quite clear that you are trying to assign a string directly to the TextBox, but you should assign that to TextBox.Text property.


如错误所示,您无法将字符串转换为文本框。

尝试 Text1.text = myString;
As the error suggests, you cannot convert string to textbox.
Try Text1.text = myString;


我认为你写的是这样的

i think you are writting like this
string Str = TextBox1;





代替写





instead write

string Str = TextBox1.Text;


这篇关于窗口表单应用程序中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆