I made an chat application that uses listBox and each time someone sends a new message the text is displayed in the list box, I want to make so if someone sends either message starting with http or https to be clickable and open the link in an default browser. I use Visual Studio 2019 Enterprise. I tried searching the web but didn't find what I was looking for and I have no idea how to do it myself. Any help highly appreciated.
EDIT: I want to make links clickable that are displayed in an listBox screenshot its an win forms application
1. Get the selected item as string - listBox1.SelectedItem.ToString(); https://stackoverflow.com/a/18065641/13028588
2. Find word that has http:// or https:// C# - Maybe this can help https://learn.microsoft.com/en-us/dotnet/csharp/how-to/search-strings
https://learn.microsoft.com/en-us/dotnet/api/system.string.contains?view=net-5.0
Find text in string with C#
3. After you get the link as string you can use this -System.Diagnostics.Process.Start("https://thelink.com"); - How to open in default browser in C#
This is just to point you in the right direction hopefully.
Related
I'm experimenting with help files and help-providers.
My issue is I cannot display the help file without conflicting with other help-provider code.
helpProvider1.SetShowHelp(btnFont, true);
helpProvider1.SetHelpString(btnFont, "Change the font.");
helpProvider1.HelpNamespace = "helpfile.chm";
The HelpNamespace property takes precedence over the SetHelpString method, but I still want to display these help strings.
Is the only option to use another hotkey?
Windows Forms supports "What's this .." help on individual controls (Pop-up Help). The HELP button makes sense on dialog boxes, because modal dialog boxes need to be closed before focus can go to another window. I think it's not a problem for you to translate the following samples from VB to C# (some old stuff but HTH). All this has a learn curve of course.
See Creating Pop-up Help for Visual Basic .NET controls
Please note: The Windows Forms HelpProvider component is used to associate HTML Help files (HTMLHelp 1.x, Help 2.x or single HTML file) with your Windows application. The HelpString property can be used to show Pop-Up Help but you must set the HelpNamespace property of hlpProvider1 (see HTML Help). If there is no filename and the user hits F1 the application runs to an error.
For further information see also Compiled HTML Help file shows "This program cannot display...", when pressing F1 on the debugged application.
I wanted to know if this was at all possible before I started researching. We have phones that come equipped with a javascript dialing api. Basically we open a webpage that is
phone.htm?ip=xxx&dialNumber=xxx
Is it possible to create an internet explorer toolbar to scan all the text on a webpage and either: show the phone numbers on the webpage in the toolbar, so they can click and delete them OR replace all the phone numbers on the webpage with links? Which would be more practical?
Seems like, what you are trying to do is similar to the Skype's Click-To-Call
http://www.skype.com/en/download-skype/click-to-call/
I advice you to follow the same thing that they did where the numbers in webpages turns into links
I am attempting to create a 'find on page' search option for a wp7 webbrowser control named 'TheBrowser' (using the standard webbrowser control in Visual Studio). I have done a lot of research but have not found much in the way of an example or sample where this was implemented. Essentially I will just be activating the search on a click event, from a textbox where the user may type in a word to search in the current webpage. I would also like to highlight the matched words as seen when doing a find on page search on a desktop browser.
I believe that to create this 'find on page' option I should use javascript to search through the lines of text, and then somehow highlight matched words. I have already implemented forward, back, and refresh buttons using TheBrowser.InvokeScript, but I do not know how to format for searching through the entire webpage (I have never done anything like this before). Any advice or assistance would be greatly appreciated, including code samples as I am completely new to this subject! Thanks in advance for your help and hard work!
Try jquery, this should do the trick: http://hugoware.net/blog/more-jquery-magic-search-highlighting You'll just need to inject the jquery script into the page.
I am building a WP7 app (RTM version of the dev tools, not the Mango Beta dev tools) and am using the silverlight linklabel control (http://silverlightlinklabel.codeplex.com/).
This control should find all urls in the text given to it, and turn them into hyperlinks, but i am finding that it finds the urls and inserts the hyperlinks, but no text is shown, even though the text property is set on the hyperlink object.
While i have been playing around, i have found its possible to click the hyperlink and take you into mobile IE to visit the url, but there is no visible text.
I am using the latest version of the control, i only made one change so it works correctly on WP7 which is to do with the creation of relative Uri's
So what i am asking is, has anyone else tried this and found a solution? Or is there a better way of doing it?
Thanks in advance for your help
I'm developing an application in C# using visual web developer. I'm displaying some text for reading and I want the user to be able to select a word or fragment, and then right click it to display a customized menu (One that has for example define, search, show grammar...). I
I don't know how to do it. I'm fairly new to the .Net
Thanks!
You have to do that entirely on the client-side, in JavaScript.
Note that it's considered a bad idea to take over right-click, which the user has the right to expect will work the same no matter which application they are using.