Start New Discussion within our Software Development Community

I have:

private: Void GoBtn_Click(Object^  sender, EventArgs^  e)
{				                                                                      ((WebBrowser)MultiTab->SelectedTab->Controls[0]).Navigate(SearchBar->Text);
}

But it keeps giving me an error at Controls[0] and telling me that no operator [] matches..

Control::Collection^ [int] <--- No clue what that line means..

Next it tells me that I cannot cast TabControl to (WebBrowser)

or if I do:

WebBrowser MultiTab = new WebBrowser; it tells me something about static references only..


With all that said, how am I supposed to make a new instance of a webbrowser dynamically and how do I access the browser on a specific tab?

Hi,
I dont know which library you use, however I can say that, it is possible that the

operator[]

is not overload for Controls, or it is not an array.


Secondly, when you use

new

the left hand side must be a pointer, and not a simple variable not so

WebBrowser MultiTab = new WebBrowser ;

but

WebBrowser* MultiTab = new WebBrowser();

Hope it helps

This article has been dead for over six months. Start a new discussion instead.