New Really messed up error

Code:
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
 
im not sure if thatd work..

try
Code:
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
 
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....
 
Last edited by a moderator:
Are you trying to show an existing form?
If so providing frmMain is your form.....
Code:
                 dim myForm as new frmMain
                       myform.show
myform is instantiated and shown here.
Although it is really frmMain.
 
Maybe you should show your code again. Im confused if youre 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 whats causing the error.

-nerseus
 
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.
 
Back
Top