FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Visual Basic Build Problem





Sparda
Hello,

I've been using Microsoft Visual Basic for a few weeks now. I really like the easy to use interface, but I seem to have a problem making my final build for the program. I can go into debug mode and use the program always (Unless Visual Basic is closed). Then I would have to open Visual Basic to build a new copy so I wouldn't have the problem. Here's the exact error:

Code:
C:\Users\Me\Documents\Visual Studio 2008\Projects\TheProject\TheProject\bin\Release\TheProject.exe is not a valid Win32 application.


That's just an example error. It'll just say the project name where I have "TheProject" placed. Once I rebuild the program it may work 1-2 times before it starts bringing back the error. I'm new to Visual Basic. Is there possibly something I must do/code in my program to make sure this doesn't happen? Again, I have this error in several projects. No, I wouldn't think it's a computer virus, for I only see this error from the programs I build myself.

~Thanks in Advance
milleja46
Hey can you please post your code? Sometimes it may just be a simple error in code that causes this. Trust me, i had worked on a program called FireNET that i started and got many errors and just came up as a spelling error, or a wrong placement of code. Take you time and you wil probably figure it out. Wink
Sparda
It's just a simple MP3 player using VLC Player's plugin.

Here's the code:

Code:
Public Class Form1
    Dim clock As Boolean
    Dim xpsf As String
    Dim pause As Integer
    Dim check As Integer
    Dim song As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
        Timer2.Start()
        check = 0
    End Sub
    Private Sub AxVLCPlugin21_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxVLCPlugin21.Enter
        If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.CurrentDirectory + "\Song.mp3") Then
            AxVLCPlugin21.playlist.add(My.Computer.FileSystem.CurrentDirectory + "\Song.mp3", "title", "creator")
            AxVLCPlugin21.playlist.play()
            pause = 1
            song = 1
        Else
            Button3.Text = "Play"
            song = 0
            pause = 0
            TrackBar1.Enabled = False
        End If
    End Sub
    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
        For Each track As String In OpenFileDialog1.FileNames
            If track.EndsWith(".xpsf") Then
                AxVLCPlugin21.playlist.playItem(1)
            Else
                If song = 0 Then
                    AxVLCPlugin21.playlist.add(track, "title")
                    AxVLCPlugin21.playlist.play()
                    pause = 1
                    song = 1
                Else
                    AxVLCPlugin21.playlist.add(track, "title")
                End If
            End If
        Next
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If song = AxVLCPlugin21.playlist.items.count Then
            MsgBox("No more songs in the Database. Please use the Import button.", MsgBoxStyle.DefaultButton1, "No More Songs!")
        Else
            song = song + 1
            AxVLCPlugin21.playlist.stop()
            AxVLCPlugin21.playlist.next()
            pause = 1
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        OpenFileDialog1.Filter = "Music Files|*.mp3;*.mid;*.occ;*.mp4;*.avi;*.mpeg;*.flv;*.wmv|XPSF|*.xpsf|All Files|*.mp3;*.mid;*.occ;*.mp4;*.avi;*.mpeg;*.xpsf"
        OpenFileDialog1.ShowDialog()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If song = 1 Then
            'blah
        Else
            If song > 0 Then
                song = song - 1
                AxVLCPlugin21.playlist.stop()
                AxVLCPlugin21.playlist.prev()
                pause = 1
            End If
        End If
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If song > 0 Then
            If AxVLCPlugin21.playlist.isPlaying Then
                AxVLCPlugin21.playlist.togglePause()
                pause = 0
                check = 0
            Else
                If pause = 0 And TrackBar1.Value < 98 And song > 0 Then
                    TrackBar1.Enabled = True
                    AxVLCPlugin21.playlist.play()
                    Button3.Text = "Pause"
                    pause = 1
                    check = 0
                Else
                    If song = AxVLCPlugin21.playlist.items.count Then
                        MsgBox("No more songs in the Database. Please use the Import button.", MsgBoxStyle.DefaultButton1, "No More Songs!")
                    Else
                        TrackBar1.Enabled = True
                        AxVLCPlugin21.playlist.stop()
                        AxVLCPlugin21.playlist.next()
                        Button3.Text = "Pause"
                        pause = 1
                        check = 0
                    End If
                End If
            End If
        End If
    End Sub

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        'AxVLCPlugin21.input.Time = TrackBar1.TickFrequency)
        Timer1.Interval = 200
        check = 1
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If pause = 1 And song > 0 Then
            If AxVLCPlugin21.input.Time > 10 And check = 0 And AxVLCPlugin21.playlist.isPlaying Then
                TrackBar1.Value = ((AxVLCPlugin21.input.Time * 100) / AxVLCPlugin21.input.Length)
                Timer1.Interval = 100
            Else
                If TrackBar1.Value > 5 And TrackBar1.Value < 95 And AxVLCPlugin21.playlist.isPlaying And check = 1 Then
                    AxVLCPlugin21.input.Time = ((TrackBar1.Value * AxVLCPlugin21.input.Length) / 100)
                    check = 0
                Else
                    If TrackBar1.Value < 11 And check = 1 Then
                        AxVLCPlugin21.input.Time = 50
                        check = 0
                    End If
                    If TrackBar1.Value > 94 And check = 1 Then
                        check = 0
                    End If
                End If
            End If
        End If
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MsgBox(AxVLCPlugin21.input.Time)
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If song > 0 Then
            If AxVLCPlugin21.playlist.isPlaying Then
                pause = 1
                Button3.Text = "Pause"
                Timer2.Interval = 100
                TrackBar1.Enabled = True
            Else
                pause = 0
                Button3.Text = "Play"
                Timer2.Interval = 100
                TrackBar1.Enabled = False
            End If
        End If
    End Sub

    Private Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.Scroll
        AxVLCPlugin21.Volume = TrackBar2.Value
        If TrackBar2.Value > 0 Then
            If AxVLCPlugin21.Volume = 98 Then
                AxVLCPlugin21.Volume = 100
                TrackBar2.Value = 100
                Label1.Text = Str(TrackBar2.Value) + "%"
            Else
                Label1.Text = Str(TrackBar2.Value) + "%"
            End If
        Else
            Label1.Text = "Mute"
        End If
    End Sub
End Class
milleja46
Does it give any errors when you debug? If so what line numbers? And how did you build the form for this?(location of everything, ide, etc)
Sparda
There are no errors. As far as I know there are no bugs with this specific program. Again, this build problem happens with all my Visual Basic builds. The only thing I can think would be the problem is the OS. I'm running Windows 7 Home Edition on a dell system. 1. The OS software may be corrupted. 2. Visual Basic may not yet be fully capable with Windows 7. I may reinstall with my previous Windows Vista software.
fladry
If visual basic created a manifest file, delete it and try to run the program. If there is static linking option in visual basic(i don't use visual basic so i don't know) you can try to build your program with static linking. And you didn't specified the version of visual basic you are using. Try to copy only your executable to new location and run it. But the message box appears in my PC(win XP) only due to the manifest problem.
AftershockVibe
I've seen this floating around for a while now and a thought struck me as to what this might be...

Just because the window has closed, doesn't necessarily mean the application has stopped running. It's perfectly possible to close (presumably) a Windows Form without the program actually running Exit() or Quit() code (I forget which it is in .Net).

If your program is running, you won't be able to write to the file. I could be a tonne of things, but checking its quitting properly can't hurt.
Sparda
Quote:
If visual basic created a manifest file, delete it and try to run the program. If there is static linking option in visual basic(i don't use visual basic so i don't know) you can try to build your program with static linking. And you didn't specified the version of visual basic you are using. Try to copy only your executable to new location and run it. But the message box appears in my PC(win XP) only due to the manifest problem.


I have tried putting the executable into another folder with the required DLL's for running. Basically this is a small MP3 Player using VLC's pluggin. Also, when I created this project I was using a registered version of Visual Basic 2008 that was downloaded off the Microsoft website. I tried compiling the project on two other computers, but eventually the executable failed to run. I also took the Visual Studio 2008 CD that I got out of my college book for compiling, yet no progress.

Quote:
I've seen this floating around for a while now and a thought struck me as to what this might be...

Just because the window has closed, doesn't necessarily mean the application has stopped running. It's perfectly possible to close (presumably) a Windows Form without the program actually running Exit() or Quit() code (I forget which it is in .Net).

If your program is running, you won't be able to write to the file. I could be a tonne of things, but checking its quitting properly can't hurt.


Actually, I have not thought about that. I have the form setup for Fixed3D. I suppose I could put in my own Close/Minimize buttons and just remove Microsoft's form buttons at the top. I believe the close functions can be either Exit or Me.Close. I'll have to check my processes the next time I run my program to be sure the program actually closed. Thanks for the suggestion. I'll give it a try.
milleja46
It may also may be that the ide if it is msvs basic just does not have windows 7 support yet. And is due to have errors and other things like what has occured with you.
Related topics
Visual Basic Tutorial - Control Arrays: What, Why and How
help me ..,.,about visual basic
VB 6 problem executing a .exe program via a visual basic app
Visual Basic RUles
Visual Basic 6 vs Visual Basic 2010
Microsoft Visual Basic help
C#,Visual Basic.NET,Visual Studio.NET Videos
visual basic.net
MS Visual Basic Studio 2005 Express Edition
Visual Basic Tutorial - File I/O in VB: Text Files
Visual Basic Tutorial - Looping
Visual Basic Express Addition
Visual Basic programming tutorial
graphic programming in visual basic
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.