Posted 20 years ago
by Jeff Bridges

Hi,
I'm trying to implement the Highlighter into my .Text based blog, however, it doesn't seem to work with the control, so therefore I tried using the CodeHighLighterEngine class like in the code below.
However, I get the following error message:
"System.NullReferenceException: Object reference not set to an instance of an object."
which occurs on the GenerateHtmlInline method.
Is it even possible to use the code highlighting w/o the web control? If yes, how?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim engine As New ActiproSoftware.CodeHighlighter.CodeHighlighterEngine
Dim language As New ActiproSoftware.SyntaxEditor.SyntaxLanguage("VB.NET", False)
Dim code As String = "'Test" & System.Environment.NewLine & "Dim code As String"
Dim output As String = engine.GenerateHtmlInline("1", code, language)
Label1.Text = output
End Sub
Greetings
I'm trying to implement the Highlighter into my .Text based blog, however, it doesn't seem to work with the control, so therefore I tried using the CodeHighLighterEngine class like in the code below.
However, I get the following error message:
"System.NullReferenceException: Object reference not set to an instance of an object."
which occurs on the GenerateHtmlInline method.
Is it even possible to use the code highlighting w/o the web control? If yes, how?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim engine As New ActiproSoftware.CodeHighlighter.CodeHighlighterEngine
Dim language As New ActiproSoftware.SyntaxEditor.SyntaxLanguage("VB.NET", False)
Dim code As String = "'Test" & System.Environment.NewLine & "Dim code As String"
Dim output As String = engine.GenerateHtmlInline("1", code, language)
Label1.Text = output
End Sub
Greetings