winforms - Very basic? C++/CLI problem -
i'm using vc++ 2010.
i'm getting error c2228. says must struct, class or unioun before .text.
private: system::void textbox1_textchanged(system::object^ sender, system::eventargs^ e) { using namespace std; for(int r=0; r>(sizeof(x)/sizeof(x[0])); r++){ if (x[r][1].find(textbox1.text) != string::npos){ label1.text = (label1.text+x[r][1]); label2.text = (label1.text+x[r][2]); } } }
it searches 2d array , sees if matches you've typed , displays while you're typing, main feature of application making. errors on if statement, 2 statements after twice , that's it, .text bringing errors on 5 attempts read it, identical error posted above.
try instead:
using namespace std; private: system::void textbox1_textchanged(system::object^ sender, system::eventargs^ e) { for(int r=0; r > (sizeof(x) / sizeof(x[0])); r++) { if (x[r][1].find(textbox1.text) != string::npos){ label1.text = (label1.text + x[r][1]); label2.text = (label1.text + x[r][2]); } } }
the using command should @ highest level , formatting nicer that. hope solves problem.
Comments
Post a Comment