Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Doesnot show image in datagridview for the first time when set an MDIParent property
 

Doesnot show image in datagridview for the first time when set an MDIParent property

I am writting following code in Form_Load

grdBooking.DataSource = dt;

for (int i = 0; i < grdBooking.Rows.Count - 1; i++)

for (int j = 0; j < grdBooking.Columns.Count; j++)

{

grdBooking.Rows[i].Cells[j].Value =imgList.Images[ Convert.ToInt32( dt.Rows[i][j].ToString())];

}

But when I load the form in MDIParent then for the first time it doesnt show any image. It Shows cross image (No Picture).
Now if I move above code to From Activate then once the form is loaded, it shows proper images after 3/4 seconds.
If I dont set MDIParent, then Form works properly.

Could anybody elaborate the reason?

nilesh Kalyankar  Monday, September 21, 2009 6:25 AM

Hi,

I have tested on my side. Unfortunately, I can’t reproduce.

In form1:

private void Form1_Load(object sender, EventArgs e)

{

GetData();

dataGridView1.DataSource = dt1;

ImageList imgList = new ImageList();

imgList.Images.Add(Image.FromFile(@"C:\Users\v-lingw\Desktop\smile.gif"));

dataGridView1.Rows[0].Height = 50;

dataGridView1.Rows[0].Cells[0].Value = imgList.Images[0];

}

Show form1 in form2:

public partial class Form2 : Form

{

public Form2()

{

InitializeComponent();

}

private void toolStripButton1_Click(object sender, EventArgs e)

{

Form1 f = new Form1();

f.MdiParent = this;

f.Show();

}

}

DataGridView still show the image.

I think I must miss something. Could you please provide more details or make a demo project for us to test? Please upload your demo project to some server and offer us the URL. Skydrive (http://skydrive.live.com/ ) may be a good option. You can sign up 25GB free space only with your Windows Live Passport.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Saturday, September 26, 2009 5:41 PM

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Wednesday, September 30, 2009 3:00 AM

You can use google to search for other answers

Custom Search

More Threads

• OnPaintEvent Issue(help please)
• How to insert combo box in datagridview cell in VB.net 2005?
• Changing culture problem
• Control.Visible Property Problem
• Browse the Hard Disk and get path of a folder in Vb.Net 2005?
• Custom Controls losing Event Handlers and WithEvents
• Designer error since using VSS
• need help for BindingNavigator control
• listview mess up
• Vs.net tab loog and feel for winforms tab page object