Hey guys! First post here, so sorry if this is in the wrong section. I did a quick search and couldn't find much about this though, which is unfortunate

Basically, I'm trying to make a database system that will allow a youth group I'm in to be able to sort out our database a lot better, and be more efficient when calling the kids we look after.

My idea was to make a program that reads an excel file (the current database we have is in an excel file). It then makes a text file in a specified folder about each kid (so, for example, John Smith.txt would open up all the info about John Smith). Now, that's not an improvement on itself, but that's the unsorted folder. The sorted folder then sorts the kids into different grades, regions, and into families, so I could easily call all families with last name from A-F, then someone else could take families G-M etc. Or, I could call all the kids in grade 3, while someone else takes all of the kids in grade 4 etc, and same with regions (or cities/suburbs/states/whatever you want to call them).

In the sorted folder, instead of having a text file with all the kids again, it's got a Windows shortcut, so if you edit John Smith.txt, all the shortcut files will still direct to the text file and give you updated info .

So, I've made the program, tested it out, works perfectly from my end. I make it into .exe file, put it into separate folder, add a read me and a sample database, and run it, still works perfectly for me. I give it to my friend to run, works perfectly for him.

And then I give it to another friend, and on the 2 computers he's tried it on, before the program can even run, the error "WindowsApplication1.exe has stopped working, looking for solutions" or similar appears, and he can't run it. Thankfully he's a beta tester before everyone gets a hold of it, but I'd still like to know what's wrong so he can run it!

Does anyone have any ideas about why it's saying that, or how to fix it? In all my experience with coding (not much, but better than nothing), I haven't seen an error like this unless something went horribly wrong with the code, in which case that error would appear no matter what computer I tried it on!

Sorry for the long post, I'm tired and tend to ramble a lot when I'm tired :P

By default 'click once' automatically runs an app directly after install.
If there are any run-time conditions that are not met the program crashes.

Since your messing about with folders and files
you might want to check if any are missing on the target machine.
Ideally you should be wrapping 'try catch end try ' structures around
around disk access in your code.

BTW a single simple Microsoft database can do
what you are trying to do with text files and folders.

You write your program such that it reads and writes to the db.
Searching, filtering, and sorting are a breeze.

__________________Burn the land and boil the sea
You can't take the sky from me

I'm not using "click once to deploy", though it sounds interesting. What is it? I just use the "build application" to get an exe file of the program. Also, in the properties, I disabled "Enable application framework".

All the files that I have in the folder are on the other machine - the .exe file, a .pdb file, a .xmp file, ExcelImport.dll (for the excel stuff) and IWshRuntimeLibrary.dll (for the shortcut stuff).

As for the database - I've never had any luck making a database, despite my attempts, and this seemed like more fun to me :P. Also, there are some things that my program does that I don't know how viable it would be to do in a database program

Click Once is a deployment tool that comes with vb.net 2010. It determines all the components your program will need and creates a setup package on a cd or network drive.
There are other set up package options, but those are the simplest. Look up tutorials on click once.

Click Once is a deployment tool that comes with vb.net 2010. It determines all the components your program will need and creates a setup package on a cd or network drive.
There are other set up package options, but those are the simplest. Look up tutorials on lone.

Do the computers that are having problems have the correct version of the .Net framework installed?

That's a very good question... I have a feeling maybe not. I disbaled the application framework if that makes any difference? But I think one of the computers I'm trying this out on has had another one of my programs work before, though I could be wrong?

"Application Framework" just tells VB to generate a lot of code that enables default form instances, automatic application settings, and a handful of other features that are nice to have but aren't always needed. It is very unlikely that this is the source of your problems, so don't worry about it.

The crash behavior of programs on machines without an SDK installed makes figuring out exactly what happened difficult. On a system with a debugger, generally you get a chance to start the debugger and at least see what the exception was (if you get that far into the program.) Have a peek inside Event Viewer, run the program, then see if any Application log failures appear. You might get lucky and end up seeing an exception name. Or, if you see a failure that says something to the effect of not being able to find "mscoree.dll" then the machine does not have the .NET Framework installed.

That'd be the first thing I'd check. There's probably easier ways, but a good test is to just create a plain old application that does nothing and try to run it. If that fails, you know the .NET Framework's your problem. For VS 2008 it'd be odd to find a Vista or newer machine without .NET 2.0 but it's /possible/. The easiest way to fix it is to point your browser at Smallest Dot Net, but since you /specifically/ need .NET 2.0 that might not work. Your life will be a little easier from a deployment standpoint if you at least upgrade to VS 2010, though the free versions of 2012 are a heck of a lot easier to find and there's no reason to avoid them. (If anything, it helps people tell you where in the IDE certain things are.)

If .NET isn't the problem, then some small changes can shed some light on what's going wrong. (My guess is one of your DLLs or their dependencies isn't being deployed.)

Does your application have a Sub Main()? It probably doesn't, and this is a little easier from a Sub Main(). So open your project properties and dig in the tabs until you find the "Startup Object" dropdown. It's probably set to "Form1" or whatever your main form is. There should be a "Sub Main" choice in the dropdown, pick it. Then add a new Module to the project. I usually call mine "Program.vb". Then it should look something like this:

Code:

Module Program
Public Sub Main()
Application.EnableVisualStyles()
' You have to edit this line to use your startup form.
Application.Run(New Form1())
End Sub
Public Sub UnhandledExceptionHandler(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
Dim exceptionObject As Object = e.ExceptionObject
System.IO.File.WriteAllText("error.txt", e.ToString())
End Sub
End Module

This is a /little/ bit of a gamble because it's /possible/ it won't have permission to write the file to its own directory. But if it "succeeds", then it will create a file error.txt that contains a dump of whatever the exception thought was important. Every bit of information helps.

"Application Framework" just tells VB to generate a lot of code that enables default form instances, automatic application settings, and a handful of other features that are nice to have but aren't always needed. It is very unlikely that this is the source of your problems, so don't worry about it.

The crash behavior of programs on machines without an SDK installed makes figuring out exactly what happened difficult. On a system with a debugger, generally you get a chance to start the debugger and at least see what the exception was (if you get that far into the program.) Have a peek inside Event Viewer, run the program, then see if any Application log failures appear. You might get lucky and end up seeing an exception name. Or, if you see a failure that says something to the effect of not being able to find "mscoree.dll" then the machine does not have the .NET Framework installed.

That'd be the first thing I'd check. There's probably easier ways, but a good test is to just create a plain old application that does nothing and try to run it. If that fails, you know the .NET Framework's your problem. For VS 2008 it'd be odd to find a Vista or newer machine without .NET 2.0 but it's /possible/. The easiest way to fix it is to point your browser at Smallest Dot Net, but since you /specifically/ need .NET 2.0 that might not work. Your life will be a little easier from a deployment standpoint if you at least upgrade to VS 2010, though the free versions of 2012 are a heck of a lot easier to find and there's no reason to avoid them. (If anything, it helps people tell you where in the IDE certain things are.)

If .NET isn't the problem, then some small changes can shed some light on what's going wrong. (My guess is one of your DLLs or their dependencies isn't being deployed.)

Does your application have a Sub Main()? It probably doesn't, and this is a little easier from a Sub Main(). So open your project properties and dig in the tabs until you find the "Startup Object" dropdown. It's probably set to "Form1" or whatever your main form is. There should be a "Sub Main" choice in the dropdown, pick it. Then add a new Module to the project. I usually call mine "Program.vb". Then it should look something like this:

Code:

Module Program
Public Sub Main()
Application.EnableVisualStyles()
' You have to edit this line to use your startup form.
Application.Run(New Form1())
End Sub
Public Sub UnhandledExceptionHandler(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
Dim exceptionObject As Object = e.ExceptionObject
System.IO.File.WriteAllText("error.txt", e.ToString())
End Sub
End Module

This is a /little/ bit of a gamble because it's /possible/ it won't have permission to write the file to its own directory. But if it "succeeds", then it will create a file error.txt that contains a dump of whatever the exception thought was important. Every bit of information helps.

Thanks for this! The thing is, I've got 2 beta testers now, and they both can't run it, even though they have both been able to run another one of my programs on the same computers from a few weeks ago :S. Would it be worth trying that Sub Main() thing? If I may ask, what exactly does it do? I haven't used modules as such before, so not quite sure what it is :S?