Question

Overflow. I have an application which is supposed to convert a video via DirectShowSource.
I have a checkbox which enables a button called "btnviewcrop" which shows a new form called crp.vb for cropping/shearing pixels off the video.

Now, I have a Panel1 that I want to set as the owner (the video drawing surface) but when I set it to open, the application crashes (Error: Object reference not set to an instance of an object.) and I do not understand how to fix it.

Here is my button code:

Imports Microsoft.DirectX.AudioVideoPlayback
Private Sub btnviewcrop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnviewcrop.Click
     Me.ShowInTaskbar = False
     Me.Enabled = False
     crp.Show()
     Dim cropperv As Video
     cropperv.Owner = crp.preview 'VS2010 reports that cropperv has been used before being assigned a value'
     cropperv.FromFile(labinputfile.Text, True)
     cropperv.Play()
End Sub
Was it helpful?

Solution

I don't think you ever assign anything to cropperv. Did you mean

Dim cropperv As New DirectX.AudioVideoPlayback

OTHER TIPS

Good point, and if I do this:

Dim cropperv As New Video(labinputfile.Text, True)
cropperv.Owner = crp.preview
cropperv.Play()

Then all works out fine besides the resizing needs done. I appreciate the help, Matti.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top