Click here to Skip to main content
13,597,791 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, all, i am new here.
I need some help, i made web browser in c#. I have combobox for url typing,and I can't solve problem showing url in combobox, here is code:

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
          //comboBox1.SelectedItem = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).Text.ToString();
         //comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).ToString();

I tryed this, but it's not working, p.s. i know this is comment //..


Okay, sorry, but i am new here..I need to show page url in combobox, so, i need to convert combobox to string, and i tried this codes and it's not working, do you know how to convert combobox to string?
Posted 2-Feb-13 2:16am
Updated 2-Feb-13 2:31am
OriginalGriff 2-Feb-13 8:21am
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
"It's not working" is not a helpful error description: what is it doing that it shouldn't, or not doing that it should?
Use the "Improve question" widget to edit your question and provide better information.
Irbaz Haider Hashmi 2-Feb-13 8:26am
Can you describe what error you are getting from it?
2-Feb-13 8:33am
I am not getting an eror, it just won't show url, when i go to, from my home page (let say"google") and when i click back button it steal showing not ("")...
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I think you want to show the Webbrowser URI in the combobox?

If this you need then use this

2-Feb-13 8:54am
Yes.. In wich event i need to type the code? Thanks!
Irbaz Haider Hashmi 2-Feb-13 8:58am
comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).Url.AbsoluteUri;
Irbaz Haider Hashmi 2-Feb-13 8:57am
If you want to add this after document complete event of webbrowser you can add that event to webbrowser.
You can search for other events of webbrowser as well. and can decide what suits you best.
2-Feb-13 9:12am
Thank You!
2-Feb-13 9:35am
I just wondering, if i don't use webbrowser component, and i use tabcontrol, which i event should use, in tabcontrol there is not a documentcomplited?
Irbaz Haider Hashmi 2-Feb-13 12:13pm
You want to get the Tab text?
if so you can get like this

3-Feb-13 8:05am
I uploded image of my webbrowser, you will see what is my problem, i marked it..
I know the code, but i don't know wich event i should use for url - combobox1 show and wich event for tabcontrol1 - title html show..
Here is image: " "..

Thank you for helping me!
Irbaz Haider Hashmi 3-Feb-13 15:38pm
For tab control you can use Selected event. When you select any tab then you can get the webbrowser url and update that in combox box. This is what i think you want to achieve?

On comboxbox selection changed you want to navigate the selected webbrowser to the selected url?
3-Feb-13 17:07pm
I am still having a problem.. Here is an image:
What to type to show url in comboBox1? Thanks!
Irbaz Haider Hashmi 3-Feb-13 17:13pm
comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[tabControl1.SelectedIndex]).Url.AbsoluteUri;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[tabControl1.SelectedIndex]).Url.AbsoluteUri;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180621.3 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100