apuma
asked on
getting an error when switching between programs and when running exe
hello experts whenever i switch to another program window then return to the project i get this error
or if i try to execute the .exe file
An unhandled exception of type 'System.NullReferenceExcep tion' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.
the debugger then points to the first line
Public Class Form1
of my project.
i doublechecked that form1 is set as the default form
any ideas on what could cause this?
thanks in advance
or if i try to execute the .exe file
An unhandled exception of type 'System.NullReferenceExcep
Additional information: Object reference not set to an instance of an object.
the debugger then points to the first line
Public Class Form1
of my project.
i doublechecked that form1 is set as the default form
any ideas on what could cause this?
thanks in advance
Are you doing anything in LostFocus or Deactivated events of your form?
-Baan
-Baan
ASKER
no I can just have a blank form with only the connection set-up and i will get this error.
sounds interesting. Lets see where and how you are making the connection.
-Baan
-Baan
ASKER
i am connecting using the server explorer, which creates a sqlconnection and a sqldataadapter object in the "bin" under the design form.
if i run the project from VS it runs fine selects and saves data with no issue. just when i switch to another screen then switch back.
if i run the project from VS it runs fine selects and saves data with no issue. just when i switch to another screen then switch back.
Personally I like to make connections to the database from my code. (wizards scare me.......:() ) That in turn gives you more control on things specially when things go wrong. Moreover its easy to debug. If you want to switch to coding method, I would love to help you whenever you need it.
In your case, hmm...., how about reinstalling framework? (again I am not sure).
-Baan
In your case, hmm...., how about reinstalling framework? (again I am not sure).
-Baan
ASKER
I agree with your point about the wizards. not the biggest fan either. im fairly new at vb.net so i would probbably need some help figuring out how to databind in code. im guessing it's fairly easy to just copy what the windows generated stuff does. ill give that a shot and see what i come up with
ASKER
So i did some more testing and i tried starting a new project in "my vasual studios projects" folder with nothing on it at all no connections no anything, and i get that problem. so it is not the sql connection causing it. if i run a project from my flash drive it runs perfectly. any ideas? could this be a .net framework issue?
Quite possible. Try installing Framework SDK.
http://msdn.microsoft.com/netframework/downloads/framework1_1/
-Baan
http://msdn.microsoft.com/netframework/downloads/framework1_1/
-Baan
One more thing .. how much free disk space and RAM do you have?
-Baan
-Baan
ASKER
46 gigs of free space and 512mb ram
i moved the project on to my flash drive and it runs fine from there on the same machine, also works fine on other machines from the .exe
i moved the project on to my flash drive and it runs fine from there on the same machine, also works fine on other machines from the .exe
ASKER
if i copy the .exe from the flash drive to the c drive that also executes without issue.
It means that your framework is working just fine. Only when you run something in DEBUG mode with VB.Net it's not working. Chances are your VS.Net is not installed properly. What do you think?
-Baan
-Baan
ASKER
why would it work if the project was sitting on a flash drive and not when it is on the c drive?
the only thing i can think is that maybe there is a conflict with the NTFS where as i beleive the flash storage is FAT
the only thing i can think is that maybe there is a conflict with the NTFS where as i beleive the flash storage is FAT
But when you run the exe from your hard disk it's working fine.. right?
ASKER
yes, i think the problem uccors during compilation, when on my c drive.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
re-installing from our disk is not an option as the disk is scratched.
so i may just be SOL
that or the flash drive becomes a permanent fixture to the machine
so i may just be SOL
that or the flash drive becomes a permanent fixture to the machine
ASKER
i started a blank project and connected to the same database and i get simmilar errors.
Is there a special step i need to go through to connect to a sql DB on a server besides using the server explorer and generating a dataset?