Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 //..
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 2-Feb-13 3:16am
Edited 2-Feb-13 3:31am
v2
Comments
OriginalGriff at 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 at 2-Feb-13 8:26am
   
Can you describe what error you are getting from it?
Nemanja Petrovic at 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")...
Rate this: bad
good
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
 
((WebBrowser)tabControl1.SelectedTab.Controls[0]).Url.AbsoluteUri
  Permalink  
Comments
Nemanja Petrovic at 2-Feb-13 8:54am
   
Yes.. In wich event i need to type the code? Thanks!
Irbaz Haider Hashmi at 2-Feb-13 8:58am
   
comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[0]).Url.AbsoluteUri;
Irbaz Haider Hashmi at 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.
Nemanja Petrovic at 2-Feb-13 9:12am
   
Thank You!
Nemanja Petrovic at 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 at 2-Feb-13 12:13pm
   
You want to get the Tab text?
if so you can get like this
 
tabControl1.SelectedTab.Text
Nemanja Petrovic at 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: " http://i45.tinypic.com/2vxndlg.png "..
 
Thank you for helping me!
Irbaz Haider Hashmi at 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?
 
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.selected.aspx
 
On comboxbox selection changed you want to navigate the selected webbrowser to the selected url?
Nemanja Petrovic at 3-Feb-13 17:07pm
   
I am still having a problem.. Here is an image: http://i47.tinypic.com/166zvkh.png
What to type to show url in comboBox1? Thanks!
Irbaz Haider Hashmi at 3-Feb-13 17:13pm
   
comboBox1.Text = ((WebBrowser)tabControl1.SelectedTab.Controls[tabControl1.SelectedIndex]).Url.AbsoluteUri;
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 DamithSL 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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