Computing.Net > Forums > Programming > URL-highlighting TextBoxes in C#?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

URL-highlighting TextBoxes in C#?

Reply to Message Icon

Name: Leo the 28C (by Sulfurik)
Date: May 31, 2005 at 14:16:14 Pacific
OS: Windows XP SP2
CPU/Ram: 2.8 GHz/448 MB
Comment:

Hello everyone! :D
OK, I've seen many apps that have TextBoxes that highlight URL's when you type them in, and when you click on those URL's, they open up your browser with that URL in the address bar... My question is, where can I download a C# control that does this? Or do I have to code my own? How? Thanks! ;)

http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Little Johnny took a drink
but he shall drink no more.
For what he thought was H2



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: May 31, 2005 at 16:48:53 Pacific
Reply:

Code your own, its easy enough. Use the Create Process API and providing the text box contains a properly formed URL, the CreateProcess API will load you default browser and run the URL.

You can use the FindExecutable API to find which is your default browser.

I can show you how to do it in VB, but in C# you are on your own.

Stuart


0

Response Number 2
Name: Leo the 28C (by Sulfurik)
Date: May 31, 2005 at 18:13:06 Pacific
Reply:

Hmm... all of those API's are for VB only... :S Or is it in a Windows DLL? Which one? Thanks! ;)

http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Little Johnny took a drink
but he shall drink no more.
For what he thought was H2


0

Response Number 3
Name: StuartS
Date: May 31, 2005 at 20:38:47 Pacific
Reply:

There is no such thing as a VB API. APIs can be used by any language as they are part of the operating system. VB,C++, C# and many others. The only difference is the syntax. Do a search on at Microsoft to find them. All the examples are in C++ so you may have to adjust them for C# of which I know nothing.

Stuart


0

Response Number 4
Name: Leo the 28C (by Sulfurik)
Date: May 31, 2005 at 21:13:06 Pacific
Reply:

OK, I found this on MSDN:
http://support.microsoft.com/default.aspx?scid=kb;en-us;174156#appliesto
But the examples are in VB...I kinda understand the VB syntax, but I don't know its functions, which there are many in the article... :S

http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Little Johnny took a drink
but he shall drink no more.
For what he thought was H2


0

Response Number 5
Name: StuartS
Date: May 31, 2005 at 22:27:33 Pacific
Reply:

All it is doing is creating a Dummy file with an HTML extension. It can be a zero length file.

The file name is then fed into the FindExecutalble API along with a dummy variable and fixed length string to receive the path name of the browser.

The string is then trimmed to remove extra spaces at the end then then fed into ShellExecute which is similar to CreateProcess but not so flexible.

The ShellExecute API contains the handle of the currently running task, the "open" command, the path name to the browser in the variable BrowserExec, the URL to be opened, another dummy variable, and the a constant to define the way the windows is shown.

With both APIs is the value returned < 32 then an error occurred.

Finally the dummy file created earlier is killed off.

The only code there that is unique to VB is the bit that creates the dummy HTML file and the Trim command which trims spaces of the end of a string. MsgBox just displays a message in the screen with an OK button. I am sure you can work something out in C# to do the same.

Look here for a description of the APIs

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/findexecutable.asp

It says it applies to Wint NT and Windows 95 but it works fine under Winows XP and Windows 98.

Stuart


0

Related Posts

See More



Response Number 6
Name: Leo the 28C (by Sulfurik)
Date: June 1, 2005 at 09:31:25 Pacific
Reply:

Well, I just decided I'll cancel that program since there's many around, but someday I'll need that, so I'll check out the links. Much thanks! ;)

http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Little Johnny took a drink
but he shall drink no more.
For what he thought was H2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: URL-highlighting TextBoxes in C#?

Syntax highlighting in C#?? www.computing.net/answers/programming/syntax-highlighting-in-c/12680.html

How to clear a textbox in asp.net www.computing.net/answers/programming/how-to-clear-a-textbox-in-aspnet-/8234.html

Menus in C/C++ www.computing.net/answers/programming/menus-in-cc/2005.html