specified cast is not valid.

A

Ansari

hi all,

I have a windows application which is developed in VB.NET.
I have used some bitmaps and set image property of button.
Some time I load form programmaticaly.. following error pops up

1) Specified Cast is not valid
it is on the following line of code.
Me.Button1.Image = CType(resources.GetObject("Button1.Image"),
System.Drawing.Bitmap).

To sovle this problem I CUT the button and paste it again and save project
next time i run it work fine....

What is the problem?



Ansari
 
G

Guest

Ansari,
Do you enable XP styles? If you do, check you have called DoEvents(). In
C#, something like this:

static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new MainForm());
}

Regards,
Phil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top