dcsimg
Results 1 to 17 of 17

Thread: [RESOLVED] How to make my program work in Windows 7 ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Resolved [RESOLVED] How to make my program work in Windows 7 ?

    I completed my VB project a while back and it worked great in XP.
    Now the same program is needed on computers that have Win7 installed.

    The program installs without any problems, but when I open it, it gives me an error saying the database is not accessible.

    I used Visual Studio 2008 and SQL Compact to design the project.
    The database was included in the project and in the installation file. I also checked the Programs folder and the database was installed correctly into the correct path...

    What is the problem with my programs compatibility with Windows 7?

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: How to make my program work in Windows 7 ?

    Is this a writing issue? You are not giving us much information, so we need to guess what's happening.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by Radjesh Klauke View Post
    Is this a writing issue? You are not giving us much information, so we need to guess what's happening.
    Sorry about that... My Windows (and error) is in Finnish so it will be a bit difficult to try and explain. But here I'll give it a shot:


    Not sure what kind of issue this is... The error in English is as follows:
    "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

    There is a lot of information in the error report. But the first lines are as follows:

    ************** Poikkeuksen teksti **************
    System.BadImageFormatException: Yritettiin ladata ohjelma, joka on väärää muotoa. (HRESULT-poikkeus: 0x8007000B)
    kohteessa System.Data.SqlServerCe.NativeMethods.CreateErrorInstance(IntPtr& pError)
    kohteessa System.Data.SqlServerCe.SqlCeCommand..ctor()
    kohteessa MyProject.DB_MyProjectDataSetTableAdapters.ProjektiTableAdapter.InitCommandCollection() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\DB_MyProjectDataSet.Designer.vb:rivillä 28040
    kohteessa MyProject.DB_MyProjectDataSetTableAdapters.ProjektiTableAdapter.get_CommandCollection() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\DB_MyProjectDataSet.Designer.vb:rivillä 27878
    kohteessa MyProject.DB_MyProjectDataSetTableAdapters.ProjektiTableAdapter.SELECT_Avattujen_Projektien_Määrä() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\DB_MyProjectDataSet.Designer.vb:rivillä 28725
    kohteessa MyProject.Etusivu.Alavalikon_PÄIVITYS() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\Etusivu.vb:rivillä 187
    kohteessa MyProject.Etusivu.Panel3_MouseMove(Object sender, MouseEventArgs e) tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\Etusivu.vb:rivillä 248
    kohteessa System.Windows.Forms.Control.WmMouseMove(Message& m)
    kohteessa System.Windows.Forms.Control.WndProc(Message& m)
    kohteessa System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    kohteessa System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



    I guess the above lines are in incorrect format or something?
    When I go to the VB project in Visual Studio and look at the lines that are specified above as beeing in icorrect format, I see the following codes:

    Row 28040 of DB_MyProjectDataSet.Designer.vb
    Me._commandCollection(0) = New Global.System.Data.SqlServerCe.SqlCeCommand

    Row 27878 of DB_MyProjectDataSet.Designer.vb
    Me.InitCommandCollection

    Row 28725 of DB_MyProjectDataSet.Designer.vb
    Dim command As Global.System.Data.SqlServerCe.SqlCeCommand = Me.CommandCollection(6)

    Row 187 of Form Etusivu.vb
    If (ProjektiTableAdapter.SELECT_Avattujen_Projektien_Määrä = 0) Then

    Row 248 of Form Etusivu.vb is also referring to the action that includes the code seen above...

  4. #4
    New Member
    Join Date
    Jul 2011
    Posts
    6

    Re: How to make my program work in Windows 7 ?

    Try to change the compatibility i properties on the exe file to XP sp 3

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by jackmarrow View Post
    Try to change the compatibility i properties on the exe file to XP sp 3
    Yep. I did change the compatibility of the .exe but it still gives me the same error.

    Any ideas?

  6. #6
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: How to make my program work in Windows 7 ?

    I don't understand most of the error so I started to google: Here's something you may want to look to: http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by Radjesh Klauke View Post
    I don't understand most of the error so I started to google: Here's something you may want to look to: http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx
    Yep, I took a look at that link already but couldn't figure out what unmanaged code this referred to:
    "This exception is thrown when unmanaged code is passed to Load for loading."

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Also, the target computer has Windows 7, 64 bit.
    The program was created on Win XP, 86 bit.

    Don't think this should matter as in the 'Compile' options the target CPU is set as 'AnyCPU'...

  9. #9
    Addicted Member
    Join Date
    Nov 2010
    Location
    TamilNadu, India
    Posts
    249

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by Hamsori View Post
    Also, the target computer has Windows 7, 64 bit.
    The program was created on Win XP, 86 bit.

    Don't think this should matter as in the 'Compile' options the target CPU is set as 'AnyCPU'...

    86 Bit OMG how's 86 Bit............


    really interesting to know about 86Bit.....amazing...........

  10. #10
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by medsont View Post
    86 Bit OMG how's 86 Bit............


    really interesting to know about 86Bit.....amazing...........
    32-bit or x86...
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  11. #11
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: How to make my program work in Windows 7 ?

    Is SQL CE installed on the Windows 7 machine?
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by medsont View Post
    86 Bit OMG how's 86 Bit............


    really interesting to know about 86Bit.....amazing...........
    Yeah, ment 32bit.




    Translated-->
    (OMG!!!11 ...amazing!!11.... LOLZZZ....... Ment to say 32 bitz!!!1)

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by mbutler755 View Post
    Is SQL CE installed on the Windows 7 machine?
    Yes, it is.
    The .NET Framework is version 4 Client Profile.
    Have tried to run the programn in XP compatibility mode.
    Also checked the database-file included in my program installation and all the info is there...

  14. #14
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by Hamsori View Post
    Also, the target computer has Windows 7, 64 bit.
    The program was created on Win XP, 86 bit.

    Don't think this should matter as in the 'Compile' options the target CPU is set as 'AnyCPU'...
    Bada-bing! When you compile an executable for 'Any CPU', it will run as a 32-bit process on 32-bit windows and a 64-bit process on a 64-bi windows.

    A 64-bit process cannot load a 32-bit-only DLL (and vice-versa). If you try it you get an error saying... (can you guess?)

    An attempt was made to load a program with an incorrect format.

    In other words, your libraries are the wrong 'bitness'.

    Recompiling your app for x86 would be the quickest solution here. That will force it to run as a 32-bit process on your 64-bit box.

    This isn't actually a problem, and you may in fact see a performance increase over it running as a 64-bit process.

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Dec 2010
    Posts
    110

    Re: How to make my program work in Windows 7 ?

    Quote Originally Posted by Evil_Giraffe View Post
    Bada-bing! When you compile an executable for 'Any CPU', it will run as a 32-bit process on 32-bit windows and a 64-bit process on a 64-bi windows.

    A 64-bit process cannot load a 32-bit-only DLL (and vice-versa). If you try it you get an error saying... (can you guess?)

    An attempt was made to load a program with an incorrect format.

    In other words, your libraries are the wrong 'bitness'.

    Recompiling your app for x86 would be the quickest solution here. That will force it to run as a 32-bit process on your 64-bit box.

    This isn't actually a problem, and you may in fact see a performance increase over it running as a 64-bit process.
    I just got a strong urge to kiss you!
    I did what you said in VS and created an installation file and suddenly it all worked like a charm on a Win7 64 bit computer! Now it actually seems very logical and simple...

    Thank you!


    (These were the most frustrating 2 days ever because of this "problem")
    Last edited by Hamsori; Jul 13th, 2011 at 03:11 AM.

  16. #16
    New Member
    Join Date
    Jul 2012
    Posts
    2

    Resolved Re: [RESOLVED] How to make my program work in Windows 7 ?

    I am using VB 2010, this worked for me. I changed EVERYTHING to x86, including the Config Manager. The problem I have had for several months now (on some computers, but not others) is now resolved.

    Thank you so much for posting this!

  17. #17
    New Member
    Join Date
    Jul 2012
    Posts
    2

    Lightbulb Re: [RESOLVED] How to make my program work in Windows 7 ?

    I didn't know about the 86-bit either. That was a new one for me.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width