NullPtrEx while calling "invisible" gdviewer

Using GdPicture.NET in WPF application.
Post Reply
umueller
Posts: 6
Joined: Mon Dec 21, 2015 4:49 pm

NullPtrEx while calling "invisible" gdviewer

Post by umueller » Thu Jan 28, 2016 2:54 pm

Hi there,

I have have an example which makes gdviewer.Clear() (and other MF) go NullPtrEx.

The attached example references the gdviewer from another page without prior displaying it (but it says it's initailized). If the tab with the gdviewer is shown everything works. But just staring up an pressing the button crashes it (but not all functions would crash).


Regards

UM
Attachments
gdviewer_example.zip
Contains some VB code and some xaml code
(2.29 KiB) Downloaded 47 times

User avatar
Loïc
Site Admin
Posts: 5545
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: NullPtrEx while calling "invisible" gdviewer

Post by Loïc » Sat Jan 30, 2016 11:09 pm

Hi,

Could you attach all the project's files?

Kind regards,

Loïc

umueller
Posts: 6
Joined: Mon Dec 21, 2015 4:49 pm

Re: NullPtrEx while calling "invisible" gdviewer

Post by umueller » Mon Feb 01, 2016 8:46 am

Hi,

here you go. Hope it's complete.

Regards
Attachments
playground.zip
All files
(11.53 KiB) Downloaded 51 times

User avatar
Loïc
Site Admin
Posts: 5545
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: NullPtrEx while calling "invisible" gdviewer

Post by Loïc » Tue Feb 02, 2016 4:33 pm

Hi,

You are trying to reach a non loaded element. Please use such code:

Code: Select all

        Dim gdViewer As GdPicture11.WPF.GdViewer = DirectCast(System.Windows.Application.Current.MainWindow, MainWindow).gd.gdViewer
        If gdViewer.IsLoaded Then
            gdViewer.Clear()
        End If
Please let me know if you need further information.

With best regards,

Loïc

umueller
Posts: 6
Joined: Mon Dec 21, 2015 4:49 pm

Re: NullPtrEx while calling "invisible" gdviewer

Post by umueller » Tue Feb 02, 2016 5:53 pm

Hi,

thank you for the quick answer.

But how can I initialize the gdviewer even if it's wasn't shown before? Suppose I don't want to call 'Clear()' but 'DisplayFromGdPictureImage(pid)' to display an image? For our eval application the user selects a picture and other data and then switches to the page with gdviewer which crashes the app.

Best regards :)

UM

User avatar
Loïc
Site Admin
Posts: 5545
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: NullPtrEx while calling "invisible" gdviewer

Post by Loïc » Tue Feb 02, 2016 9:34 pm

Hi,

I guess you can select by code the tab hosting the GdViewer control. In all case the control must be loaded before interacting with it from code behind.

With best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest