c# - Winforms Null Reference Exception -


at moment trying open first video file in winform application using this vlc library

as far can tell, have set properly. have followed of source code sample projects give , created winform in style of sample project. when run project , open file, null reference exception on following code, namely line vlccontrol.media = media;:

  if (openfiledialog.showdialog(this) == dialogresult.ok)   {      var media = new pathmedia(openfiledialog.filename);      vlccontrol.media = media;   } 

i know null reference errors happen because haven't initialized something, eyes, media has been set new object. why compiler throwing fit?

update i've fixed issue. had rebuild , re-add dll had fix issue. thank help.

there 2 options cause this.

  1. vlccontrol null (hasn't been constructed or initialized) @ point. cause exception occur since you're trying access media property.
  2. vlccontrol raising exception because it's internal state not setup properly. if setting media property causes code run internally, , state not setup properly, can raise exception.

you should able @ exception details or locals window (to check vlccontrol being null) determine problem lies.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -