Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Imports WindowsApplication3.Dx9
Public Module ModMain
   Public D3d As New Direct3d
   Public frmMain As New Form
   Public WithEvents Tmr As Timer
   Public Sub Main()
       Dim Video As New Video("C:\1.asf")
       Dim Audio As New Audio("C:\song_1.mid", True)
       Tmr = New Timer
       Tmr.Interval = 6000
       AddHandler Tmr.Tick, AddressOf EXITGAME
       frmMain.WindowState = FormWindowState.Maximized
       frmMain.Show() 'error
       Dim pp As New Microsoft.DirectX.Direct3D.PresentParameters
       pp.Windowed = False
       pp.BackBufferCount = 1
       pp.BackBufferFormat = Microsoft.DirectX.Direct3D.Format.X8R8G8B8
       pp.BackBufferHeight = 768
       pp.BackBufferWidth = 1024
       pp.SwapEffect = Microsoft.DirectX.Direct3D.SwapEffect.Copy
       If Not D3d.Initialize(frmMain, pp, 0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing) Then
           Debug.WriteLine("Failed Once")
       End If
       Audio.Play()
       AddHandler Video.Ending, AddressOf EXITGAME
       D3d.PlayVideo(Video)
       Tmr.Enabled = True
   End Sub
   Public Sub EXITGAME(ByVal sender As Object, ByVal e As EventArgs)
       End
   End Sub
End Module

its now saying that the form doesnt have an instance and frmmain.show

Posted

im not sure if that'd work..

 

try

Public FormMain as WindowsApplication3 '(im assuming this is the name of your form because it says it at the top :-))

 

and then FormMain.Show might work

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted (edited)

NEW AND IMPROVED ERROR

 

Fixed the old one

try

frmmain.show

catch

frmmain = new form

frmmain.show

end try

Now an even better one,...

Debug.writeline("1")

returns the same error (object not set to an instance....) ive tried adding an imports system.diagnostics but that didnt help,.. HELP

Note the Debug line comes in right after the end try..... Just trying to see how far it gets before it crashes....

Edited by rifter1818
Posted

Are you trying to show an existing form?

If so providing frmMain is your form.....

                dim myForm as new frmMain
                      myform.show
                

myform is instantiated and shown here.

Although it is really frmMain.

  • *Experts*
Posted

Maybe you should show your code again. I'm confused if you're saying frmMain is or is not a form. I think frmMain is a form and ModMain is your module.

 

Maybe start commenting out code as well, such as Audio and Video, and see if that helps - try narrowing down the problem until you can see what's causing the error.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Final Post

 

I eventually gave up and created a new project which works (well that part does at least the videos still messed up but thats a different post and section (directx)), Anyways the wierd thing is that copy/paste the code into a new project fixed the error. Sorry to bother you all on a wild goose chase like this but thanks very much for your help with this and many other problems i run into.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...