image display code- error

Page 1 of 1

2 Replies - 2548 Views - Last Post: 18 June 2012 - 06:52 AM Rate Topic: -----

#1 guy_shalev  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-June 12

image display code- error

Posted 17 June 2012 - 03:10 AM

 dim xpic as image

dim image as new bitmapimage
dim imagepath as string = "c:\users\public\pictures\sample pictures\desert.jpg"
image.begininit()
image.urisource = new uri(imagepath, urikind.absolute)
image.end()

xpic.source = image


my problame is this:
xpic.source = image
gives an error that says "variable 'xpic' is used before it has been assigned a value."

what am i donig wrong?

Is This A Good Question/Topic? 0
  • +

Replies To: image display code- error

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: image display code- error

Posted 18 June 2012 - 04:54 AM

You have this code...

Dim xpic As Image



Which is creating the variable. However, you never actually assign it a value. Try changing it to this...

Dim xpic As Image = New Image()


Was This Post Helpful? 0
  • +
  • -

#3 guy_shalev  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-June 12

Re: image display code- error

Posted 18 June 2012 - 06:52 AM

thanks ! it works well!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1