Posts

FTP - Server in C# FtpWebRequest

Image
Hi All, Here is an example how to use the FtpWebRequet Video: Code: using System; using   System.ComponentModel; using   System.Windows.Forms; using   System.Net;// need to added using   System.Threading; // need to added using   System.IO;// need to added namespace WindowsFormsApp2 {     public partial class FTP : Form     {         public string Username;         public string Filename;         public string Fullname;         public string Server;         public string Password;         public string path;         public string localdest;         public FTP()         {             InitializeComponent();             if (checkdown.Checked == true)       ...

SFTP download - upload

Image
Hi All, here is the code for the sftp class to download and upload. Video Code: using System; using   System.Collections.Generic; using   System.ComponentModel; using   System.Data; using   System.Drawing; using   System.Linq; using   System.Text; using   System.Threading.Tasks; using   System.Windows.Forms; using   System.IO; using   System.Net; using   WinSCP; using   Renci.SshNet; using   Renci.SshNet.Sftp; using   System.Threading; namespace WindowsFormsApp3 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }          private void  button1_Click( object sender, EventArgs e)         {             MessageBox.Show("D...

Classes in C#

Image
Hi Everyone, Today, I am posting a short video showing how to create a simple class in C#. As you may know, a class is like a template to create an object with certain characteristics. A class contains public, private, constructors, and methods. In the next and first video about classes, I make a class with public and private variables. for a class, it is better to create all as private that and declare properties as public, doing this we are avoiding to let other parts of the code to modify the variables.

Using ZipFile

Image
Hi Everyone, I have started programming in C# for couple of days, I was trying to use Zipfile class, but I faced many issues. So I felt the obligation to share them with you, and how to solve it. 1. The reference wasn't added by default, so you need to add the references System.IO.Compression and System.IO.Compression.FileSystem. 2. Using the class ZipFele I had a problem with the access. I always received the access denied error because the clas Zipfile used the whole path including the name and the extension. ZipFile.ExtractToDirectory(compressfiles[i], extractPath); Below the code and a video with the explanation: Reference: https://msdn.microsoft.com/en-us/library/system.io.compression.zipfile_methods(v=vs.110).aspx  Programs: private void button1_Click(object sender, EventArgs e)         {             MessageBox.Show("Hello");             string startPath = @"C:\Users\\D...