Click here to Skip to main content
15,914,400 members
Home / Discussions / C#
   

C#

 
AnswerRe: context menu strip? Pin
Giorgi Dalakishvili14-Sep-07 23:31
mentorGiorgi Dalakishvili14-Sep-07 23:31 
QuestionGridview rowUpdating e.NewValue,e.OldValue returns empty Pin
ss.mmm14-Sep-07 11:09
ss.mmm14-Sep-07 11:09 
QuestionHow to underline text programmatically Pin
Dino2Dino14-Sep-07 10:55
Dino2Dino14-Sep-07 10:55 
AnswerRe: How to underline text programmatically Pin
Matthew Cuba14-Sep-07 16:05
Matthew Cuba14-Sep-07 16:05 
QuestionRe: How to underline text programmatically Pin
Dino2Dino17-Sep-07 10:54
Dino2Dino17-Sep-07 10:54 
QuestionSession, Cache or Viewstate? Pin
ss.mmm14-Sep-07 10:30
ss.mmm14-Sep-07 10:30 
AnswerRe: Session, Cache or Viewstate? Pin
mr.mohsen14-Sep-07 11:38
mr.mohsen14-Sep-07 11:38 
QuestionWhich interface to use to select the whole page for search? Pin
Ahmad Zaidi14-Sep-07 10:27
Ahmad Zaidi14-Sep-07 10:27 
Hi,

I am creating a custom web browser. For that I need to make a custom search function. The problem is that I am unable to create text ranges from framed pages such as wikipedia articles. The code is as follows. I would appreciate any help:

//function to find a given string in the page
public int findString(string wordToFind, int myIndex)
{


MSHTML.IHTMLDocument2 htmldom = (MSHTML.IHTMLDocument2)wBrowser.Document.DomDocument;

IHTMLElement outerMostElement;
IHTMLDocument2 doc = (IHTMLDocument2)wBrowser.Document.DomDocument;

if (wBrowser.Document.Body.Parent.ClientRectangle.IsEmpty) {
outerMostElement = doc.body;
}
else {
outerMostElement = doc.body.parentElement;
}

//Create the range
MSHTML.IHTMLTxtRange range1 = MSHTML.IHTMLTxtRange)((MSHTML.IHTMLBodyElement)outerMostElement).createTextRange();
//CType(htmldom.selection.createRange(), MSHTML.IHTMLTxtRange)


//Get the initial start point of the text range
if (range1.text.Substring(myIndex).IndexOf(wordToFind) != -1) {
myIndex = range1.text.Substring(myIndex).IndexOf(wordToFind) + myIndex;
range1.moveStart("character", myIndex);

frmSearch.Hide();
this.Activate();
range1.findText(wordToFind, 0, 0);
range1.select();

//set the start position of the range for te next try
myIndex += wordToFind.Length;

range1.collapse();

return myIndex;
}

else {
return -1;
}

}

Ahmad
QuestionUsing Process Start Pin
TheJudeDude14-Sep-07 9:41
TheJudeDude14-Sep-07 9:41 
AnswerRe: Using Process Start Pin
Pete O'Hanlon14-Sep-07 10:33
mvePete O'Hanlon14-Sep-07 10:33 
GeneralRe: Using Process Start Pin
TheJudeDude14-Sep-07 10:36
TheJudeDude14-Sep-07 10:36 
GeneralRe: Using Process Start Pin
TheJudeDude14-Sep-07 10:45
TheJudeDude14-Sep-07 10:45 
GeneralRe: Using Process Start Pin
Giorgi Dalakishvili14-Sep-07 11:14
mentorGiorgi Dalakishvili14-Sep-07 11:14 
AnswerRe: Using Process Start Pin
Nathan Holt at EMOM14-Sep-07 10:45
Nathan Holt at EMOM14-Sep-07 10:45 
GeneralRe: Using Process Start Pin
TheJudeDude14-Sep-07 10:53
TheJudeDude14-Sep-07 10:53 
GeneralRe: Using Process Start Pin
Giorgi Dalakishvili14-Sep-07 11:16
mentorGiorgi Dalakishvili14-Sep-07 11:16 
GeneralRe: Using Process Start Pin
TheJudeDude14-Sep-07 11:21
TheJudeDude14-Sep-07 11:21 
GeneralRe: Using Process Start Pin
Giorgi Dalakishvili14-Sep-07 11:30
mentorGiorgi Dalakishvili14-Sep-07 11:30 
GeneralRe: Using Process Start Pin
TheJudeDude14-Sep-07 14:39
TheJudeDude14-Sep-07 14:39 
GeneralRe: Using Process Start Pin
Giorgi Dalakishvili14-Sep-07 22:53
mentorGiorgi Dalakishvili14-Sep-07 22:53 
Questionhow to playBack streaming video ? Pin
hdv21214-Sep-07 9:18
hdv21214-Sep-07 9:18 
AnswerRe: how to playBack streaming video ? Pin
Dave Kreskowiak14-Sep-07 9:27
mveDave Kreskowiak14-Sep-07 9:27 
GeneralRe: how to playBack streaming video ? Pin
hdv21214-Sep-07 11:15
hdv21214-Sep-07 11:15 
QuestionBreak Points in my Custom Attribute class Pin
Sha Sea14-Sep-07 7:26
Sha Sea14-Sep-07 7:26 
AnswerRe: Break Points in my Custom Attribute class Pin
Nathan Holt at EMOM14-Sep-07 10:56
Nathan Holt at EMOM14-Sep-07 10:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.