Skip to content

Instantly share code, notes, and snippets.

@Fresh-Dev
Created February 10, 2016 19:21
Show Gist options
  • Save Fresh-Dev/e517ae61ab9f04b4a7d8 to your computer and use it in GitHub Desktop.
Save Fresh-Dev/e517ae61ab9f04b4a7d8 to your computer and use it in GitHub Desktop.
Use StreamReader to stream data to a datagrid.
using (StreamReader reader = new StreamReader(filePathLoadedData, true))
{
string line;
int counter = 1;
while ((line = reader.ReadLine()) != null)
{
try
{
string domain = "";string user = "";string pass = "";
string[] readed;line = line.Remove(0, 6);string[] tmp_extracted_domain = line.Split(':');
string tmp_lineNew = tmp_extracted_domain[1];string[] tmp_getServer = tmp_lineNew.Split('@');
user = tmp_extracted_domain[0];pass = tmp_getServer[0];domain = tmp_getServer[1];
dg_loadedFtp.Rows.Add(counter,domain,user, pass, "", "");
counter++;
}
catch (Exception ex) { }
} reader.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment