ASP.NET nullreference

G

Guest

hi following problem in my asp.net project:

i have embedded folloging ocx object in my aspx html code:
<OBJECT id="VideoCapX1" style="Z-INDEX: 101; LEFT: 216px; WIDTH: 368px;
POSITION: absolute; TOP: 120px; HEIGHT: 288px"
classid="clsid:912FB007-DD9A-11D3-BD8D-DAAFCB8D9378" >


then i want to get the object in my aspx.vb code...

Protected WithEvents VideoCapX1 As VIDEOCAPXLib.VideoCapX
VideoCapX1 = CType(Me.FindControl("VideoCapX1"), VIDEOCAPXLib.VideoCapX)

okay...now i want to change a property of it:
VideoCapX1.Connected = False

and there´s the error message at "VideoCapX1.Connected = False":

"Object reference not set to an instance of an object"
"System.NullReferenceException: Object reference not set to an instance of
an object"

can anyone help me? :(
 
G

Guest

My advice is to get away from the embedded object reference and move
completely to code behind. To do this, you will be best served by creating a
..NET wrapper. If you use Visual Studio, adding a COM reference creates the
wrapper for you. If not, use tlbimp.exe to create the wrapper.

I am not fond of declaratively setting up an object that has to be used
programatically. Your mileage may vary. :)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top