Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
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:

C#
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 //..
Thanks!

IMPROVE QuESTION:

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
Updated 2-Feb-13 2:31am
v2
Comments
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?
[no name] 2-Feb-13 8:33am    
I am not getting an eror, it just won't show url, when i go to www.codeprojects.com, from my home page (let say"google") and when i click back button it steal showing www.codeprojects.com not ("google.com")...

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

If this you need then use this

((WebBrowser)tabControl1.SelectedTab.Controls[0]).Url.AbsoluteUri
 
Share this answer
 
Comments
[no name] 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.
[no name] 2-Feb-13 9:12am    
Thank You!
[no name] 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?
C#
comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[tabControl1.SelectedIndex]).Url.AbsoluteUri;
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900