VBC Compiler

jnash

Well-known member
Joined
Oct 20, 2006
Messages
111
Programming Experience
Beginner
i want to compile this form below using vbc, but i know that im either missing references for the flash and the media player when i compile it, which references do i use everything i try doesnt seem to work
also VBC is giving out a error saying that .imagelocation is not a member of picturebox (which it is !!)

im using this to compile

VB.NET:
vbc /t:winexe /reference:System.dll,System.Windows.Forms.dll,System.Data.DLL,system.drawing.dll /out:testform form1.vb
and the basic form i want to compile using vbc is this:

VB.NET:
Imports System
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports system.Drawing.color
Imports AxWMPLib.AxWindowsMediaPlayer
Imports AxWMPLib.AxWindowsMediaPlayer
Imports xInterop.ShockwaveFlashObjects
Public Class FirstForm
Shared Sub Main()
Dim temp As New System.Drawing.Point
Dim temp1 As New System.Drawing.Size

Dim FirstForm As New form
FirstForm.Text = "FirstForm"
FirstForm.BackColor =Black


Dim audio1 As New AxWMPLib.AxWindowsMediaPlayer
temp.X =189
temp.Y =307
audio1.Location = temp
temp1.width = 375
temp1.height = 115
audio1.Size = temp1 
audio1.Parent = FirstForm
audio1.URL ="C:\Documents and Settings\halo9\My Documents\Visual Studio 

2005\Projects\Multimedia Authoring System\bin\media\Audio\Audio1.MP3"
Dim image1 As New PictureBox
temp.X =186
temp.Y =142
image1.Location = temp
temp1.width = 372
temp1.height = 150
image1.Size = temp1
image1.Parent = FirstForm
image1.ImageLocation ="C:\Documents and Settings\halo9\My Documents\Visual Studio 

2005\Projects\Multimedia Authoring System\bin\media\Image\Image1.Jpeg"
image1.SizeMode = PictureBoxSizeMode.StretchImage


Dim tbox As New Textbox
temp.X =187
temp.Y =34
tbox.Location = temp
temp1.width = 377
temp1.height = 97
tbox.Size = temp1
tbox.Parent = FirstForm
tbox.Text = "Helllo"
tbox.BorderStyle = BorderStyle.FixedSingle


Dim tbox As New Textbox
temp.X =243
temp.Y =28
tbox.Location = temp
temp1.width = 0
temp1.height = 0
tbox.Size = temp1
tbox.Parent = FirstForm
tbox.Text = ""
tbox.BorderStyle = BorderStyle.FixedSingle

FirstForm.Showdialog()


end sub
end Class
The errors im getting are:

VB.NET:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\halo9>cd desktop

C:\Documents and Settings\halo9\Desktop>vbc /t:winexe /reference:System.dll,Syst
em.Windows.Forms.dll,System.Data.DLL,system.drawing.dll /out:testform firstform.
vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\Documents and Settings\halo9\Desktop\FirstForm.vb(5) : error BC30466: Namespa
ce or type 'AxWindowsMediaPlayer' for the Imports 'AxWMPLib.AxWindowsMediaPlayer
' cannot be found.

Imports AxWMPLib.AxWindowsMediaPlayer
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(6) : error BC30466: Namespa
ce or type 'AxWindowsMediaPlayer' for the Imports 'AxWMPLib.AxWindowsMediaPlayer
' cannot be found.

Imports AxWMPLib.AxWindowsMediaPlayer
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(7) : error BC30466: Namespa
ce or type 'ShockwaveFlashObjects' for the Imports 'xInterop.ShockwaveFlashObjec
ts' cannot be found.

Imports xInterop.ShockwaveFlashObjects
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(18) : error BC30002: Type '
AxWMPLib.AxWindowsMediaPlayer' is not defined.

Dim audio1 As New AxWMPLib.AxWindowsMediaPlayer
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(35) : error BC30456: 'Image
Location' is not a member of 'System.Windows.Forms.PictureBox'.

image1.ImageLocation ="C:\Documents and Settings\halo9\My Documents\Visual Studi
o 2005\Projects\Multimedia Authoring System\bin\media\Image\Image1.Jpeg"
~~~~~~~~~~~~~~~~~~~~

C:\Documents and Settings\halo9\Desktop\FirstForm.vb(51) : error BC30288: Local
variable 'tbox' is already declared in the current block.

Dim tbox As New Textbox
    ~~~~

C:\Documents and Settings\halo9\Desktop>
Its really baffling me Thanks

Jon
 
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
You're using wrong version VBC compiler, since you don't qualify the path to it there must be something with your environment path (perhaps you used the Visual Studio Command Prompt for VS2003?). Each Framework has its own version vbc.exe, they are in default folders c:\windows\Microsoft.NET\Framework\v.[version]
 
thanks for your reply john, i changed it to the latest folder and im recieveing this error, i thinnk its because i havent added a reference to the audio and flash, what are the reference files i need
thank you

error:
VB.NET:
C:\Documents and Settings\halo9\Desktop>vbc /t:winexe /reference:System.dll,Syst
em.Windows.Forms.dll,System.Data.DLL,system.drawing.dll /out:testform firstform.
vb
Microsoft (R) Visual Basic Compiler version 8.0.50727.42
for Microsoft (R) .NET Framework version 2.0.50727.42
Copyright (c) Microsoft Corporation.  All rights reserved.

C:\Documents and Settings\halo9\Desktop\FirstForm.vb(5) : warning BC40056: Names
pace or type specified in the Imports 'AxWMPLib.AxWindowsMediaPlayer' doesn't co
ntain any public member or cannot be found. Make sure the namespace or the type
is defined and contains at least one public member. Make sure the imported eleme
nt name doesn't use any aliases.

Imports AxWMPLib.AxWindowsMediaPlayer
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(6) : warning BC40056: Names
pace or type specified in the Imports 'AxWMPLib.AxWindowsMediaPlayer' doesn't co
ntain any public member or cannot be found. Make sure the namespace or the type
is defined and contains at least one public member. Make sure the imported eleme
nt name doesn't use any aliases.

Imports AxWMPLib.AxWindowsMediaPlayer
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(7) : warning BC40056: Names
pace or type specified in the Imports 'xInterop.ShockwaveFlashObjects' doesn't c
ontain any public member or cannot be found. Make sure the namespace or the type
 is defined and contains at least one public member. Make sure the imported elem
ent name doesn't use any aliases.

Imports xInterop.ShockwaveFlashObjects
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(18) : error BC30002: Type '
AxWMPLib.AxWindowsMediaPlayer' is not defined.

Dim audio1 As New AxWMPLib.AxWindowsMediaPlayer
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Documents and Settings\halo9\Desktop\FirstForm.vb(51) : error BC30288: Local
variable 'tbox' is already declared in the current block.

Dim tbox As New Textbox

Thanks
 
Imports problem: you need more references.
tbox problem: you can't declare two different variables with same name.

Why aren't you using the Studio to compile? Anyway, if you need commandline compiles do compare with how it's done when you load the project in Studio, especially look into the references used there.
 
hi John references as in /references in vbc or more import statements.

also im not sure if you remember my post im making a authoring system (like a paint form) and then i have a module that outputs to a form that acts as a single form that can be compiled using vbc.exe
 
ive added all the references and it compiles however it crashes and when debugged i get

'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.

any ideas??
 
If you're using something like the code you posted you have to add the activex media player to the form before setting the Url. I told you the same thing 12 days ago: http://www.vbdotnetforums.com/showthread.php?t=18429

A reference and an Imports is two different things. The Imports is like a shortcut that lets you declare a variable without typing the full namespace path to it, but you can't import a namespace to an assembly that isn't referenced.
 
VB.NET:
Imports System
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports system.Drawing.color
Imports AxWMPLib.AxWindowsMediaPlayer
'Imports AxInterop.ShockwaveFlashObjects

Public Class FirstForm

Shared Sub Main()
Dim temp As New System.Drawing.Point
Dim temp1 As New System.Drawing.Size

Dim FirstForm As New form
FirstForm.Text = "FirstForm"
FirstForm.BackColor =Black


Dim audio1 As New AxWMPLib.AxWindowsMediaPlayer
temp.X =189
temp.Y =307
audio1.Location = temp
temp1.width = 375
temp1.height = 115
audio1.Size = temp1 
audio1.Parent = FirstForm
audio1.URL ="C:\Documents and Settings\halo9\My Documents\Visual Studio 2005\Projects\Multimedia Authoring System\bin\media\Audio\Audio1.MP3"


Dim image1 As New PictureBox
temp.X =186
temp.Y =142
image1.Location = temp
temp1.width = 372
temp1.height = 150
image1.Size = temp1
image1.Parent = FirstForm
image1.ImageLocation ="C:\Documents and Settings\halo9\My Documents\Visual Studio 2005\Projects\Multimedia Authoring System\bin\media\Image\Image1.Jpeg"
image1.SizeMode = PictureBoxSizeMode.StretchImage


Dim tbox As New Textbox
temp.X =187
temp.Y =34
tbox.Location = temp
temp1.width = 377
temp1.height = 97
tbox.Size = temp1
tbox.Parent = FirstForm
tbox.Text = "Helllo"
tbox.BorderStyle = BorderStyle.FixedSingle

FirstForm.Showdialog()

end sub
end Class
this is the code and yes i remembered, the form only compiles if i remove the "audio1.url = " line
 
I only first noticed now that you had .Parent set, I'm not used to this convention but usually do frm.controls.add and similar so I read straight passed it, well that should have done it. Perhaps you need to show the form before setting AX .Url so the correct window handles are created? Try that, show the form then set Url, (use the Show() method not ShowDialog() to see if it works)
 
nothiing that i put after the show dialog works after it (thats why its at the end) also moving the audio.url around i have tried and the same error, if i change to .show() then it shows for a second and closes (maybe something to do with the end of the form class?) also chagning between parent/controls.add doesnt make a difference!

thanks
 
nothiing that i put after the show dialog works
That's why I told you to use the Show() method instead to make it work and verify this before attempting other solutions.

You can also try instead to call the frm.CreateControl() method after ax control is added (but before the Url) to see if this is all needed for it to work. This method forces the creation of the window handle and child controls.
 
OK, I see, you are using the Sub Main as application entry point, in that case you should start the application and its message loop with Application.Run(frm) and not Show/ShowDialog. As you are setting up the ax-wmp control this will still be a problem, so you can add the wmp control in load/shown event instead.
 
Hi john im not sure if i quite understand, could you show me in the above form
it would really help me
thank you
Jon
 
here for starters:
VB.NET:
Imports System
Imports System.Windows.Forms
 
Public Class FirstForm
[SIZE=2][COLOR=#0000ff][COLOR=black]Inherits[/COLOR][/COLOR][/SIZE][SIZE=2] System.Windows.Forms.Form[/SIZE]
 
Shared Sub Main()
    application.run(new FirstForm)
end sub
 
Private Sub form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[COLOR=darkgreen]'do your load code here[/COLOR]
end sub
 
end class
You should really have a look at the windows forms generated code, for a form class named form1.vb the generated code is in file form1.Designer.vb. Click 'Show all files' in Solution Explorer to see this partial class file linked to the form (or just find it in file system).
 
Back
Top