Click here to Skip to main content
16,004,919 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd4-Sep-07 4:22
professionalVimalsoft(Pty) Ltd4-Sep-07 4:22 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd4-Sep-07 21:14
professionalVimalsoft(Pty) Ltd4-Sep-07 21:14 
GeneralRe: Datagrid Relationship Pin
alzaabi20xx4-Sep-07 23:57
alzaabi20xx4-Sep-07 23:57 
GeneralRe: Datagrid Relationship Pin
Vimalsoft(Pty) Ltd5-Sep-07 0:07
professionalVimalsoft(Pty) Ltd5-Sep-07 0:07 
QuestionInvoke event inside Flash ActiveX in VB Pin
sunco2-Sep-07 10:06
sunco2-Sep-07 10:06 
AnswerRe: Invoke event inside Flash ActiveX in VB Pin
Dave Kreskowiak3-Sep-07 4:36
mveDave Kreskowiak3-Sep-07 4:36 
QuestionAccessing exchange server public folders Pin
manisghouri2-Sep-07 8:49
manisghouri2-Sep-07 8:49 
QuestionGetting the outermost Document object in webbrowser control Pin
Ahmad Zaidi2-Sep-07 4:10
Ahmad Zaidi2-Sep-07 4:10 
Hi,

I am trying to make a custom search function for the web browser control. It works fine with single frame pages, but on pages with multiple frames such as wikipedia articles, I need to get the outermost document. I am unable to do that. Here is my code:

Dim htmldom As MSHTML.IHTMLDocument2 = CType(wBrowser.Document.DomDocument, MSHTML.IHTMLDocument2)

Dim outerMostElement As IHTMLElement
Dim doc As IHTMLDocument2 = DirectCast(wBrowser.Document.DomDocument, IHTMLDocument2)

If wBrowser.Document.Body.Parent.ClientRectangle.IsEmpty Then
outerMostElement = doc.body
Else
outerMostElement = doc.body.parentElement
End If

'Create the range
Dim range1 As MSHTML.IHTMLTxtRange = DirectCast(DirectCast(outerMostElement, MSHTML.IHTMLBodyElement).createTextRange(), MSHTML.IHTMLTxtRange)
'CType(htmldom.selection.createRange(), MSHTML.IHTMLTxtRange)


'Get the initial start point of the text range
If range1.text.Substring(myIndex).IndexOf(wordToFind) <> -1 Then
myIndex = range1.text.Substring(myIndex).IndexOf(wordToFind) + myIndex
range1.moveStart("character", myIndex)

frmSearch.Hide()
Me.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
End If

It gives a com casting error on pages such as wikipedia as its unable to cast doc.body.parentElement. Whats the solution to this?

Thanks in advance,
Ahmad
QuestionDatagridView row selection Pin
Mr Oizo2-Sep-07 3:13
Mr Oizo2-Sep-07 3:13 
AnswerRe: DatagridView row selection Pin
Widgets2-Sep-07 14:52
Widgets2-Sep-07 14:52 
Questionplease help me with combobox keycode Pin
bapu28892-Sep-07 2:16
bapu28892-Sep-07 2:16 
AnswerRe: please help me with combobox keycode Pin
Lucky Sheikh6-Sep-07 20:40
Lucky Sheikh6-Sep-07 20:40 
QuestionReplace multiple space with Single space in RichTextBox Pin
Rupesh Kumar Swami2-Sep-07 2:11
Rupesh Kumar Swami2-Sep-07 2:11 
AnswerReplace multiple space with Single space in RichTextBox Pin
Chatura Dilan2-Sep-07 3:24
Chatura Dilan2-Sep-07 3:24 
AnswerRe: Replace multiple space with Single space in RichTextBox Pin
Luc Pattyn2-Sep-07 4:04
sitebuilderLuc Pattyn2-Sep-07 4:04 
Questioncombobox questions Pin
xebe2-Sep-07 0:11
xebe2-Sep-07 0:11 
AnswerRe: combobox questions Pin
Rupesh Kumar Swami2-Sep-07 0:45
Rupesh Kumar Swami2-Sep-07 0:45 
GeneralRe: combobox questions Pin
xebe2-Sep-07 4:02
xebe2-Sep-07 4:02 
GeneralRe: combobox questions Pin
Rupesh Kumar Swami2-Sep-07 19:19
Rupesh Kumar Swami2-Sep-07 19:19 
AnswerRe: combobox questions Pin
Widgets2-Sep-07 14:58
Widgets2-Sep-07 14:58 
AnswerRe: combobox questions Pin
arjunjagtap2-Sep-07 19:39
arjunjagtap2-Sep-07 19:39 
Questioncombobox problem Pin
SamRST1-Sep-07 22:49
SamRST1-Sep-07 22:49 
AnswerRe: combobox problem Pin
Vasudevan Deepak Kumar1-Sep-07 23:09
Vasudevan Deepak Kumar1-Sep-07 23:09 
Questionpls help! Pin
Rharzkie1-Sep-07 20:51
Rharzkie1-Sep-07 20:51 
GeneralRe: pls help! Pin
Guffa1-Sep-07 22:04
Guffa1-Sep-07 22:04 

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.