RcBuilder@walla.com
call centre: 054-5614020

Binary Formatter

Posted by: RcBuilder  /   Category: bin / BinaryFormatter / Files / FileStream / Serialize / SOURCE CODE / Stream   /   No Comments
05
Oct
2014

Binary Formatter class Binary_Formatter { public void BaseObject(){ string Path = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "test.bin"); string Name = "Roby Cohen"; Console.WriteLine("SERIALIZE " + Name); BinaryFormatter formatter = new BinaryFormatter(); using (FileStream fsWrite = new FileStream(Path, FileMode.Create)) { formatter.Serialize(fsWrite, Name); } Console.WriteLine("DESERIALIZE "); using (FileStream fsRead = new FileStream(Path, System.IO.FileMode.Open)) { string WhatsMyName = (string)formatter.Deserialize(fsRead); Console.WriteLine(WhatsMyName); } } public void CustomObject() { string Path = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "test2.bin"); User user = new User(33, "Shirly Massa", "somewhere over the rainbow"); Console.WriteLine("SERIALIZE USER"); BinaryFormatter formatter.

Read more

Stream – Download File

Posted by: RcBuilder  /   Category: Files / HttpRequest / SOURCE CODE / Stream   /   No Comments
30
Sep
2014

Stream - Download File public static void CreateStreamDownload(string fileName) { System.IO.Stream stream = null; //This controls how many bytes to read at a time and send to the client int bytesToRead = 10000; // Buffer to read bytes in chunk size specified above byte; // The number of bytes read try { //Create a WebRequest to get the file HttpWebRequest fileReq = (HttpWebRequest)HttpWebRequest.Create(string.Concat(CSCode.BLL.Config.Keys.HostSyncAddress, "Uploaded/temp/", fileName)); //Create a response.

Read more

winforms – export gridview to csv or excel

Posted by: RcBuilder  /   Category: CSV / Excel / File / Files / folderBrowserDialog / MessageBox / SOURCE CODE / StringBuilder / winForms   /   No Comments
08
Sep
2014

winforms - export gridview to csv or excel string xls_file_name = .... var result = folderBrowserDialog1.ShowDialog(); if (result != DialogResult.OK) return; string xls_file_path = string.Concat(folderBrowserDialog1.SelectedPath, "\\", xls_file_name); StringBuilder sb = new StringBuilder(); // HEADER ROW // foreach (DataGridViewColumn col in dg1.Columns) sb.AppendFormat("\"{0}\"{1}", col.Name, col.Index == dg1.Columns.Count ? string.Empty : ","); sb.Append(Environment.NewLine); // CONTENT // foreach (DataGridViewRow row in dg1.Rows) { foreach (DataGridViewColumn col in dg1.Columns) sb.AppendFormat("\"{0}\"{1}", dg1.Value, col.Index ==.

Read more
  • פיתוח מערכות
  • פתרונות טכנולוגים
  • קידום אתרים
  • בניית אתרים