开发者

Creating a web chat facility in visual studio 2008 using Visual Basic

I am creating a web chat facility in visual studio 2008 using Visual Basic,I want to be able to highlight certain keywords that are sent and received to each user, can someone please tell me how I can do this? Tha开发者_运维问答nks in advance


If you're creating an Asp.net app. with VB.Net then here's something you can do: 1. On your page you may have a textbox (where the user types the text for chat) and there may be a "Send" button that postbacks the page. 2. On click of "Send", pick the text from the text box and search for your keyword, you may do something like this: if(txtChat.Text.Contains(keyword_string)) { //Highlight the text --- } else { //Send logic }

You can put the if/else in a loop if you wish to scan multiple values from the db. As for selecting the text, it's a tricky part and I myself haven't found a simple way to select partial text in an Asp.net textbox. Here's are a couple of links discussing alternate ways to perform this:

http://forums.asp.net/t/1520680.aspx

http://bytes.com/topic/javascript/answers/167174-highlighting-part-text-text-box

If it's possible you can show the words separately in a label beneath the textbox.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜