-
[2.0] Hyperlinks
How would i go about adding a link to a textbox, but the catch is it needs to display specified text but when clicked go to the web site.
So what i have is a listbox where when i go to add something i have to give the program the URL and Text. I am a little concerned how to go about this :(
Any ideas?
-
Re: [2.0] Hyperlinks
I'm a little confused by your explanation. Can you give a clear, step-by-step explanation of how you see it working?
-
Re: [2.0] Hyperlinks
I will click a button and it will make a form appear asking me to enter the text to be added to the listbox and the url.
Once i enter everything and click "Ok", I need to add the text to the listbox but somehow store the url together with the text. Because when it is clicked in the listbox it needs to execute the site in a new browser window.
-
Re: [2.0] Hyperlinks
So define your own class or, more likely, structure with a property for the friendly name and a property for the address. Create a collection of these objects and bind it to ListBox, setting the DisplayMember to display the friendly name and the ValueMember to get the URL via the SelectedValue.
-
Re: [2.0] Hyperlinks
Kk thanks, ill have a try and see if it works.
-
Re: [2.0] Hyperlinks
I would suggest making your collection a BindingList. That way you can add and remove items from the list and the bound control will update automatically. Otherwise you'd have to refresh the control manually each time.