winforms - a value type of "void" cannot be used to initialize an entity type of "System::string^" -


i following tutorial on youtube creating forms , i'm getting error when doing doing. i've searched on , cannot figure out.

here video https://www.youtube.com/watch?v=lkhgpwuclc8&list=pls1qulwo1rizz6udid--i09eoimrmphs0&index=22

below code

the part that's in bold part throwing error

string^ strcharname = openchardialog1->initialdirectory = openchardialog1->filename;

private: system::void openbutton_click(system::object^  sender, system::eventargs^  e) {      stream^ opencharacter;     openfiledialog^ openchardialog1 = gcnew openfiledialog;      if (openchardialog1->showdialog() == system::windows::forms::dialogresult::ok)     {         if ((opencharacter = openchardialog1->openfile()) != nullptr )         {              string^ strcharname = openchardialog1->initialdirectory = openchardialog1->filename;              messagebox::show(strcharname);              opencharacter->close();         }     } } 

typo:

string^ strcharname = openchardialog1->initialdirectory + openchardialog1->filename;                                                         ^ 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -