VB.NET 2005 -- "build" does not work as expected ...
Hi, Folks.
When I used VB 5.0, I had a handle on the "Build" process. I'd make an .exe and put it on the machine I wished it to run on. If it required copious data or reference files, I'd either build the directory I needed with a batch file, or put it all on a CD with an autorun.inf.
Problem is...
In VB.NET 2005, when I hit "Project" "build" I get an .exe file in the appropriate /bin/release folder, but if I copy the .exe to a CD or other drive, and try to run it on another machine, I get "The program failed to initialize properly." I've made sure that all of the files that are in the /bin/release folder are also on the CD, in case it's trying to refer to an external file.
The project runs under debug in the IDE, and the .exe runs on the development PC with the IDE closed.
One possible hypothesis that I haven't tested: The program uses a "RealPlayerG2" control to access sound file snippets. Is it possible that the target machine doesn't have RealPlayer, so the control won't work? Is that a likely cause of this error? Should I rewrite the program using a Windows Media Player control (which is .COM network instead of .NET)?
Or should I be using the "Project" "Publish" menu item, and creating a "Setup" file that the user has to run before using the program proper?
Any thoughts, comments, or war stories are welcome... I'm planning to send the completed CD to a user in Europe, so I'd like it to be bulletproof before I ship.
Re: VB.NET 2005 -- "build" does not work as expected ...
Yes, that could be a possibility and I don't think Real allow redistribution of dlls, ocx, etc so you probably need to install Real Player on the target machine in-order for your application to work correctly.
Re: VB.NET 2005 -- "build" does not work as expected ...
I'll change it over to WMP. Argh.
Re: VB.NET 2005 -- "build" still does not work as expected ...
Okay, so I went to every form and deleted the RealPlayer control, which I was calling "Real1". Then I imported COM framework controls, and used the Windows Media Player control, which I called "WMP1."
Next, I went to every code line that referred to "real1" and replaced "Real1.source =" with "WMP.URL ="
Again, this works within the IDE, and on the development computer with the IDE closed. Burning to a CD and attempting to open it on another PC, however, yields to same error: "program failed to initialize, 0x0c0000135, ..."
Same results for autorun or for manually clicking the EXE file.
I did verify that the EXE file is the new build that I built today.
Anyone got a clue, suggestion, war story?
Re: VB.NET 2005 -- "build" does not work as expected ...
possibly resolved. Tried a third machine, where it works as designed. My new theory is that the test computer did not have the. NET framework.
Re: VB.NET 2005 -- "build" does not work as expected ...
Why do you have the same control on each form? You just need to reuse your original instance.
Re: VB.NET 2005 -- "build" does not work as expected ...
Well, it's the only method that has worked for me thus far. Is there a way to make a button in one form activate a control in another form?
Re: VB.NET 2005 -- "build" does not work as expected ...
Based on the Microsoft example here.
Add 2 forms
Add the Windows Media Player control to the first form along with a button
Add a button to form2
Use the code.
Form1:
vb Code:
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Form2.Show()
End Sub
End Class
Form2:
vb Code:
Public Class Form2
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Form1.AxWindowsMediaPlayer1.URL = "C:\Users\User\Desktop\Music\Goyte feat Kimbra - Somebody That I Used To Know.mp3" ' Replace the song with one of your choosing
End Sub
End Class
Re: VB.NET 2005 -- "build" does not work as expected ...
Simple and useful. I'll do that next time.