Hi, i would like to use the SHBrowseForFolder API in vb.net
this site

i copied it to my vb.net program, i changed all the long's to integers because intergs now are 32bit, Replaced Type with Structure

and used this code to run it...
VB Code:
  1. Dim bi As New BROWSEINFO()
  2.  
  3.         Dim pidl As Integer
  4.  
  5.         bi.hOwner = Me.Handle.ToInt32
  6.         bi.pidlRoot = 0&
  7.         bi.lpszTitle = "Select Directory"
  8.         bi.ulFlags = BIF_RETURNONLYFSDIRS
  9.  
  10.         pidl = SHBrowseForFolder(bi)
  11.  
  12.         Call CoTaskMemFree(pidl)


now if i run that, i get a error on line
pidl = SHBrowseForFolder(bi) with this error..

Additional information: Object reference not set to an instance of an object.

can someone please explain what is wrong?

thanks

P.S nearly 100 Posts