'delegate declaration Delegate Function SelectedLine(ByVal tControl As Scintilla) As ScintillaNet.LinesCollection 'Timer.Tick event Dim LinesDelegate As New SelectedLine(AddressOf GetLineCollection) With Instances(If(TabControl1.InvokeRequired, SelectedTabIndexDel.Invoke(TabControl1), TabControl1.SelectedIndex))'this work perfect If .SyntaxHandle.InvokeRequired Then If .SyntaxHandle.InvokeRequired Then Lines = LinesDelegate.Invoke(SyntaxHandle)'It's the same as calling the method with out the delegate (cross thread call) Else Lines = .SyntaxHandle.Lines End If For Each line As ScintillaNet.Line In Lines'Lines is like a null object when the invoke is required 'if .invoke is used, then each "line" is a null object, other way it's not. 'code Next End With 'Delegate Function Private Function GetLineCollection(ByVal tControl As Scintilla) As ScintillaNet.LinesCollection Return tControl.Lines'It's the same as calling the method with out the delegate (cross thread call) End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)