webBrowser error

string x = msclr::interop::marshal_as< std::string >(textBox1->Text);
string::iterator i;
int a = 0;
int k = 0;

for(i = x.begin(); i < x.end(); ++i)
{
++k;
if(*i == '/')
{
++a;
}
if(a == 4 || a == 5)
x.erase(x.begin() + k);
}

webBrowser1->Url = x;

And than vas error
error C2664: 'System::Windows::Forms::WebBrowser::Url::set' : cannot convert parameter 1 from 'std::string' to 'System::Uri ^'
How can i do this?
Last edited on
I think you will be looking at something like:
1
2
3
4
5
6
//...
String^ result;
result = marshal_as<String^>( x );
Uri^ baseUri = gcnew Uri( result );
webBrowser1->Url = baseUri;
/...
Topic archived. No new replies allowed.