Not there yet

  •  12-04-2005, 7:39 PM

    Not there yet

    Ok, this is what I tried: (Attempt 1)


    Protected
    WithEvents Editor As CuteEditor.Editor
     
    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 Editor As New CuteEditor.Editor
        Response.Write("Text before editor<br>")
        ShowAnEditor()
        Response.Write("<br>Text after editor")
    End Sub
    Private Sub ShowAnEditor()
        Try
            Editor.Text = "This is a test"                                    '<- THIS IS THE ERROR LINE (On Attempt 1)
            Dim sb As New System.Text.StringBuilder
            Dim sw As New System.IO.StringWriter(sb)
            Dim htw As New System.Web.UI.HtmlTextWriter(sw)
            Editor.RenderControl(htw)                                        '<- THIS IS THE ERROR LINE (On Attempt 2)
            Response.Write(sb.ToString)
        Catch ex As Exception
            Response.Write(ex.ToString)
        End Try
    End Sub


    This is the output I got:
     
    Text before editor
    System.NullReferenceException: Object reference not set to an instance of an object. at admin.WebForm1.ShowAnEditor() in C:\Documents and Settings\ryager.RYAGER\VSWebCache\royalworldresorts.com\admin\WebForm1.aspx.vb:line 37
    Text after editor
     
     
     


    So I modified the 1st line of code by adding the NEW directive to look like this: (Attempt 2)
     
    Protected WithEvents Editor As new CuteEditor.Editor



    This is the output I got:

    Text before editor
    System.NullReferenceException: Object reference not set to an instance of an object. at CuteEditor.a.e(HtmlTextWriter A_0) at CuteEditor.a.j(HtmlTextWriter A_0) at CuteEditor.a.i(HtmlTextWriter A_0) at CuteEditor.a.k(HtmlTextWriter A_0) at CuteEditor.Editor.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at admin.WebForm1.ShowAnEditor() in C:\Documents and Settings\ryager.RYAGER\VSWebCache\royalworldresorts.com\admin\WebForm1.aspx.vb:line 42
    Text after editor
     


    I think we are getting closer just not there yet, any assistance would be helpful.
     
View Complete Thread