ASP.NET nullreference

  • Thread starter Thread starter Guest
  • Start date Start date
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? :(
 
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!
***************************
 
Back
Top