Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

system.nullRefereneceEception Object reference not set

$
0
0

I write a small edit  i put text editor on a form and text to serach in another form i define delegate event but when fire the action send this error.

this the form where i write the text to find.

namespace editorlcc
{
    ///<summary>
    /// Description of FormFind.
    ///</summary>
    publicpartialclassFormFind : Form
    {
        
        publicMainFormmform;
        publicFormEditfmedit;
        
        publicdelegatevoid FindEditFile(string texto);
        publicevent FindEditFile SearchEditFile;
        
        publicFormFind(MainForm mform )
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            this.mform = mform;

//            FormEdit fmedit= new FormEdit(mform);
//          fmedit= new FormEdit(mform);

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
        
        voidBtnFindClick(object sender, EventArgs e)
        { 
//          if(SearchEditFile != null)
//          {
              string TextFind=this.textBox1.Text;
              SearchEditFile( TextFind);
//              fmedit.FindTextEditFile(this.textBox1.Text);
            
//          }
        }
        
        voidFormFindLoad(object sender, EventArgs e)
        {
//            fmedit = new FormEdit(mform);
//            public delegate void FindEditFile(string texto);
//            public event FindEditFile SearchEditFile;
           
        }
        
    }
}

 

this the form for my editor file

namespace editorlcc
{
    ///<summary>
    /// Description of FormEdit.
    ///</summary>
    publicpartialclassFormEdit : Form
    {
        

        privateMainFormmform;
        publicFormFindfmfind;
        
//        public string tokens;
//        private string tokensmd;
//        private Regex rex ;
        publicRegexkeyWords = newRegex("mf|mn|tm|sg|sd|tc|ig|il|ic|eq|sq|,|;");
        publicRegexmacrodef = newRegex("md|mj");
        publicRegexspecialchars = newRegex(",|.|;");
        publicFormEdit(MainForm mform)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
//            FormFind  fmfind;
            
            InitializeComponent();
            this.mform = mform;
            this.fmfind = newFormFind(mform);
            
            mform.updatetextedit          += newMainForm.updateedit(updateprg);
            mform.return_rtftext          += newMainForm.get_richtextbox(getprgedit);
            mform.updated_title_edit      += newMainForm.update_title_edit(TitleWndedit);
            mform.sentfiletocontroler     += newMainForm.sendfiletocontroler(Sendtext);
            mform.curlineoneditfile       += newMainForm.getPositiononEdit(LinePosition);
            mform.CleanEditFile           += newMainForm.ClearEditFile(CleanTextEdit);
            mform.CopiedEditFile          += newMainForm.CopyEditFile( CopyTextEdit);
            mform.SelectedAllEditFile     += newMainForm.SelectEditFile( SelectedTextEdit);
            mform.SelectedPartialEditFile += newMainForm.SelectPartialEditFile(SelectPartTextEdit);
            mform.CutedEditFile       += newMainForm.CutEditFile(CutTextEdit);
            mform.DeselectedEditFile  += newMainForm.DeselectEditFile(DeselectTextEdit);
            mform.PastedEditFile      += newMainForm.PasteEditFile(PasteTextEdit);
            mform.ChangeFontEditFile  += newMainForm.changefontEdit(ChangeFontTextEdit);
            mform.UndoTextEditFile    += newMainForm.UndoEditFile(UndoChangeEdit);
            mform.DeletedTextEditFile += newMainForm.DeleteEditFile(DelEditTextFile);
            
//            fmfind.SearchEditFile     += new FormFind.FindEditFile(FindTextEditFile);
            fmfind.SearchEditFile     += newFormFind.FindEditFile(FindTextEditFile);
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
        
        voidFormEditShown(object sender, EventArgs e)
        {
    
        }

        publicvoidFindTextEditFile( string findtext)
        {
            if(richTextBoxEx1.Text.Length >0)
            {
              this.richTextBoxEx1.Find(findtext);
            }
        }

  }

}

 

I dont know if my fault is how i define de delegates or whats is wrong on this

i hope can help me.

thanks.

 


Viewing all articles
Browse latest Browse all 1764

Trending Articles