string[] langResourcePhrases;DataTable dtResource; if ((Clipboard.GetText().ToString() != null) && (Clipboard.GetText().ToString() != string.Empty)) { DataRow drRow; dsResource = new DataSet("Resource"); IDataObject xlobj; string copyLines = ""; xlobj = Clipboard.GetDataObject(); if ((System.IO.MemoryStream)xlobj.GetData("csv") != null) { StreamReader xlStream = new StreamReader((System.IO.MemoryStream)xlobj.GetData("csv")); while (!(xlStream.EndOfStream)) { copyLines = xlStream.ReadLine(); if (copyLines != null && copyLines != string.Empty && copyLines != "\0") { drRow = dtResource.NewRow(); langResourcePhrases = copyLines.Split(','); drRow[0] = langResourcePhrases[0].ToString(); drRow[1] = langResourcePhrases[1].ToString(); dtResource.Rows.Add(drRow); } } dgResource.DataSource = dtResource