Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

specified cast is not valid.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ansari - 14 Feb 2005 06:12 GMT
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
Phil Williams - 15 Feb 2005 15:51 GMT
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.

> hi all,
>
[quoted text clipped - 13 lines]
>
> Ansari

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.