I have a form which has a number of controls dynamically created on a scrollable panel which in turn is created at run time.
A textbox is present at the bottom of this form. I want to have hyperlinks on each line of this textbox. Clicking on each hyperlinks in the textbox should take me to the specific control location in the panel. Since at anytime there will be many controls on tha panel - scrolling is not very comfortable.
I do not know how to implement the hyperlink in a textbox - though i know it is possible in a richtextbox.
A suggestion on this soonest will be appreciated.
Thanks
Giftsana
Loading
GiftsanaPosted Mar 7, 2006, 9:23 PM
I meant to say we create only the reqd number controls at run time on the scrollable panel in the form.
Hope this gives a clear picture of my problem.
Sincerely
Giftsana
GiftsanaPosted Mar 7, 2006, 9:17 PM
Thanks for the reply with suggestions.
The design requires us to create all controls at runtime in a scrollable panel on the form.
Is the linklabel a good option here? i tested putting a linklabel on the textbox and in the clickevent of the linklabel control i set focus() on the reqd control.it works. but i need to create these linklabels on the textbox at run time as well - which doesnt seem to work. am creating the link label at runtime ( using this.txtbx.Controls.Add(objlinklbl1) ) but the linklabel is not visble on the textbox. am i missing something?
Thanks
Giftsana
jonPosted Mar 7, 2006, 8:24 PM
A Textbox does not have hyperlinks/Hyperlinking. Thats ok though because what you describe is not possible outside word documents anyway (even the rich text box will not jump you to an external control..).
3 different ways you can do this..
1. Redesign your form.. In many years of programming I have never seen any justification for more than 1 page of controls. Reasons not to have pages of controls include slow performance, screen flashing, memory hogging, crashes, poor maintainability etc.
Use a start page to restrict users to a subset of the controls, use a tab control, page control, menu item etc to load only the controls required.
2. Create your form as a dynamic HTML web page and embed it in your windows application.
3. If you really must have this and are familiar with graphics programming you can also:
Draw the strings on a panel object and trace the MouseDown event. When the user clicks on the panel then use the xy position to determine which item they clicked on. Use the MouseMove method to change the cursor to a hand when they are over valid text. Check ControlExit event and cancel hand cursor if it leaves the control.