public NoteMain(int ID, FromCallBackDeligate newFormCB, DelegateWriteToDB writeMsgCB, MyStickyNotes.DelegateDeleteFromDB deleteFromDB) { InitializeComponent(); // noteMessage = "None"; createNewNote = newFormCB; writeMsgToDB = writeMsgCB; deleteNoteFromDB = deleteFromDB; noteID = ID; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); }
private void getcontent(string path) { string[] files; files = Directory.GetFiles(path, "*.txt"); StringBuilder sbData = new StringBuilder(); StringBuilder sbErrorData = new StringBuilder(); Testfile df = new Testfile(); DelegateWriteToDB objDelegate = new DelegateWriteToDB(df.SendDataToDB); //dt.Columns.Add("Data",Type.GetType("System.String")); foreach (string file in files) { using (StreamReader sr = new StreamReader(file)) { String line; int linelength; string space = string.Empty; // Read and display lines from the file until the end of // the file is reached. while ((line = sr.ReadLine()) != null) { linelength = line.Length; switch (linelength) { case 5: space = " "; break; } if (linelength == 5) { IAsyncResult ObjAsynch = objDelegate.BeginInvoke(line + space, null, null); } else if (linelength == 10) { IAsyncResult ObjAsynch = objDelegate.BeginInvoke(line, null, null); } } } } }