C2228:'.Text'的左侧必须有class / struct / union [英] C2228: left of '.Text' must have class/struct/union

查看:135
本文介绍了C2228:'.Text'的左侧必须有class / struct / union的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到上述错误。我的代码如下:

I am receiving the mentioned error. My code is as follows:

String^ result;
result = marshal_as<String^>( fd.cFileName );
label.Text = result; // i have a label on form

任何想法。我有一个猜测,我需要转换String ^到字符串。如果是,那我该如何做

Any idea. i have a guess that i need to convert String^ to string. if it is, then how can i do that

推荐答案

错误信息告诉你,必须是类struct或union。如果没有那些。相反,它是一个托管类型的句柄。

The error message is telling you that the symbol to the left of . must be a class struct or union. If is none of those. Instead it is a handle to a managed type.

您的代码应为

label->text = result;

这篇关于C2228:'.Text'的左侧必须有class / struct / union的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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