Attachment: file.
I am writting some code to show images. This code is written in Form_Load event.
But I am unable to see images. If form is shown without MDI parent, it works fine. But when I set MDI Parent then it doesnt show images.
I moved the code to activate event of form But it shows images after 2/3 seconds.
Could anybody elaborate solution/reason?

Recommended Answers

All 2 Replies

Don't assign a value to each cell.

private void Form1_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            for (int i = 1; i <= 100; i++){
                dt.Columns.Add("i"+i, typeof(Image));
            }
            for (int i = 1; i <= 100; i++){
                DataRow r = dt.NewRow();
                for (int j = 0; j < 100; j++){
                    r[j] = imageList1.Images[1];
                }
                dt.Rows.Add(r);
            }
            dataGridView1.DataSource = dt;
        }

Thanks for instant reply. But due to some reasons, I am unable to store images in datatable. There are multiple functionalities on grid like drag drop, move, copy etc. Is there any other way to get rid of this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.