[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?
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.
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
Radjesh Klauke
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...
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
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
jackmarrow
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?
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
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
Radjesh Klauke
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."
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'...
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
Hamsori
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 :sick: OMG how's 86 Bit............
really interesting to know about 86Bit.....amazing...........:eek2:
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
medsont
86 Bit :sick: OMG how's 86 Bit............
really interesting to know about 86Bit.....amazing...........:eek2:
32-bit or x86...:afrog:
Re: How to make my program work in Windows 7 ?
Is SQL CE installed on the Windows 7 machine?
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
medsont
86 Bit :sick: OMG how's 86 Bit............
really interesting to know about 86Bit.....amazing...........:eek2:
Yeah, ment 32bit.
Translated-->
(OMG!!!11 ...amazing!!11.... LOLZZZ....... :eek2: Ment to say 32 bitz!!!1)
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
mbutler755
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...
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
Hamsori
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.
Re: How to make my program work in Windows 7 ?
Quote:
Originally Posted by
Evil_Giraffe
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... :rolleyes:
Thank you!
(These were the most frustrating 2 days ever because of this "problem")
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! :thumb::check::wave::D
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.
:eek2:
:afrog: