Click here to Skip to main content
15,912,205 members
Home / Discussions / C#
   

C#

 
GeneralChild Control Painting problem Pin
Jon_Slaughter8-Jul-04 13:16
Jon_Slaughter8-Jul-04 13:16 
GeneralRe: Child Control Painting problem Pin
Jon_Slaughter8-Jul-04 13:26
Jon_Slaughter8-Jul-04 13:26 
GeneralPostMessage Pin
kobybr8-Jul-04 11:38
kobybr8-Jul-04 11:38 
GeneralRe: PostMessage Pin
Serge Lobko-Lobanovsky9-Jul-04 3:44
Serge Lobko-Lobanovsky9-Jul-04 3:44 
GeneralRe: PostMessage Pin
kobybr9-Jul-04 8:56
kobybr9-Jul-04 8:56 
Questiondsoframer disables plugins?? Pin
Asad Hussain8-Jul-04 11:00
Asad Hussain8-Jul-04 11:00 
GeneralCopy from Excel and paste on DataGrid Pin
Ruchi Gupta8-Jul-04 10:54
Ruchi Gupta8-Jul-04 10:54 
GeneralRe: Copy from Excel and paste on DataGrid Pin
Nick Parker8-Jul-04 11:30
protectorNick Parker8-Jul-04 11:30 
This should work, I just threw it together so you will need to test it, but you should be able to get the idea.

IDataObject obj = Clipboard.GetDataObject();
DataTable table = new DataTable();
string data = string.Empty;
Char delim = ',';
if(obj.GetDataPresent(DataFormats.CommaSeparatedValue))
{
    StreamReader reader = new StreamReader((Stream)obj.GetData(DataFormats.CommaSeparatedValue));
    while(reader.Peek() > 0)
    {
        data = reader.ReadLine();
        string[] arr = data.Split(delim);   
        if(table.Columns.Count <= 0)
        {
            for(int i = 0; i < arr.GetUpperBound(0);i++)
                table.Columns.Add();
        }
        DataRow row = table.NewRow();
        for(int j = 0; j < arr.GetUpperBound(0);j++)
        {
            row[j] = arr.GetValue(j);
        }
        table.Row.Add(row);
    }
    reader.Close();
    dataGrid.DataSource = table.DefaultView();
}


- Nick Parker
My Blog | My Articles

GeneralRe: Copy from Excel and paste on DataGrid Pin
Heath Stewart8-Jul-04 12:10
protectorHeath Stewart8-Jul-04 12:10 
GeneralRepainting window. Pin
Nick Z.8-Jul-04 9:59
Nick Z.8-Jul-04 9:59 
GeneralRe: Repainting window. Pin
Heath Stewart8-Jul-04 11:24
protectorHeath Stewart8-Jul-04 11:24 
GeneralRe: Repainting window. Pin
Nick Z.8-Jul-04 15:24
Nick Z.8-Jul-04 15:24 
GeneralRe: Repainting window. Pin
Heath Stewart8-Jul-04 16:34
protectorHeath Stewart8-Jul-04 16:34 
GeneralRe: Repainting window. Pin
Nick Z.8-Jul-04 15:43
Nick Z.8-Jul-04 15:43 
GeneralRe: Repainting window. Pin
Nick Z.8-Jul-04 16:21
Nick Z.8-Jul-04 16:21 
GeneralRe: Repainting window. Pin
Heath Stewart8-Jul-04 16:38
protectorHeath Stewart8-Jul-04 16:38 
GeneralRe: Repainting window. Pin
Nick Z.8-Jul-04 17:00
Nick Z.8-Jul-04 17:00 
GeneralRe: Repainting window. Pin
Heath Stewart8-Jul-04 17:08
protectorHeath Stewart8-Jul-04 17:08 
GeneralRe: Repainting window. Pin
Nick Z.8-Jul-04 17:51
Nick Z.8-Jul-04 17:51 
GeneralA far more superior solution. Pin
Nick Z.8-Jul-04 18:54
Nick Z.8-Jul-04 18:54 
General&quot;contexMenu&quot; in &quot;TreeView&quot; for specific &quot;Node&quot;. Pin
novitzky8-Jul-04 9:50
novitzky8-Jul-04 9:50 
GeneralRe: "contexMenu" in "TreeView" for specific "Node". Pin
Judah Gabriel Himango8-Jul-04 9:59
sponsorJudah Gabriel Himango8-Jul-04 9:59 
GeneralRe: "contexMenu" in "TreeView" for specific "Node". Pin
novitzky8-Jul-04 22:01
novitzky8-Jul-04 22:01 
GeneralRe: "contexMenu" in "TreeView" for specific "Node". Pin
saud_a_k9-Jul-04 1:37
saud_a_k9-Jul-04 1:37 
GeneralReturning a String from Managed to Unmanaged Code Pin
SanShou8-Jul-04 6:25
SanShou8-Jul-04 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.