小编Naq*_*eeb的帖子

无法从'const char [11]'转换为'System :: Windows :: Forms :: TextBox ^'

我是c ++的新手,我正在用visual c ++制作一个程序.在出现此错误之前,一切都很顺利:

error C2440: '==' : cannot convert from 'const char [11]' to'System::Windows::Forms::TextBox ^' 
Run Code Online (Sandbox Code Playgroud)

我很确定它与我在文本框中放入数字而不是单词有关.

这是代码的一部分:

 if (fnum==true){

             if (phoneNum=="555555555"){ // i think this part causes the problem

                //code for when the phone number is correct

             } else {

                //if phone number is not correct

             }

         }
Run Code Online (Sandbox Code Playgroud)

我试过把'5555555555'代替"5555555555",但它给了我一个不同的错误

error C2015: too many characters in constant
error C2446: '==' : no conversion from 'int' to 'System::Windows::Forms::TextBox ^'
Run Code Online (Sandbox Code Playgroud)

下面是代码的其余部分:

#pragma once
#include <stdio.h>
#include <Windows.h>


bool fnum = true;

bool …
Run Code Online (Sandbox Code Playgroud)

c++-cli visual-c++

0
推荐指数
1
解决办法
741
查看次数

标签 统计

c++-cli ×1

visual-c++ ×1