Click here to Skip to main content
15,889,877 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Multiple selection in MSFlexGrid Pin
balajeedurai18-Nov-04 21:26
balajeedurai18-Nov-04 21:26 
Generallinklabel in RichTextBox Pin
Sumit Domyan17-Nov-04 19:40
Sumit Domyan17-Nov-04 19:40 
GeneralImage Control Pin
Raza Ashraf17-Nov-04 14:58
Raza Ashraf17-Nov-04 14:58 
GeneralRe: Image Control Pin
SSSSSS417-Nov-04 19:13
SSSSSS417-Nov-04 19:13 
GeneralRe: Image Control Pin
MohammadAmiry18-Nov-04 0:02
MohammadAmiry18-Nov-04 0:02 
GeneralRe: Image Control Pin
bat-nuco18-Nov-04 3:07
sussbat-nuco18-Nov-04 3:07 
GeneralRe: Image Control Pin
Mekong River18-Nov-04 20:55
Mekong River18-Nov-04 20:55 
GeneralOleCreatePictreIndirect VB6 to VB.NET Pin
djw117-Nov-04 11:14
djw117-Nov-04 11:14 
Hi All,

I have a VB6 project which uses OleCreatePictreIndirect to create a bitmap.

When this is converted to VB.NET (a change forced on me but IT services) it no longer seem to work. The code compiles but throws a;
SystemNullReferenceException: Object not set to instance of an object.

Code used is below and was originally sourced from the standard microsoft example.

Public Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (ByRef PicDesc As PicBmp, _
ByRef RefIID As GUID, ByVal fPictureOwnsHandle As Long, ByRef IPic As IPicture) As Integer


Private Function CreateBitmapPicture(ByVal hBitmap As Integer, Optional ByVal hPalette As Integer = 0) As System.Drawing.Image

Dim r As Integer
Dim Pic As PicBmp
Dim IPic As IPicture
Dim IID_IDispatch As GUID
Dim PicTypeBitmap = 1

' Fill in with IDispatch Interface ID
ReDim IID_IDispatch.Data3(0)
ReDim IID_IDispatch.Data4(7)
With IID_IDispatch
.Data1 = &H20400
.Data4(0) = &HC0S '&HC0S
.Data4(7) = &H46S '&H46S
End With

With Pic
.Size = Len(Pic)
.Type = 1 'PicTypeBitmap
.hBmp = hBitmap
.hPal = hPalette
End With

MsgBox(Pic.Size)
MsgBox(IID_IDispatch.GetType.ToString)

' Create Picture object
r = OleCreatePictureIndirect(Pic, IID_IDispatch, True, IPic)


'Return the new picture
CreateBitmapPicture = IPic

End Function

I have read some posts stating that the OleCreatePictureIndirect has changed in .NET but as I have no .NET experience and no reference material, the detail given in the solutions is lost on me.

Could someone please explain in relatively plain english the situation and the solution???

Could you also recommend some good reference material for getting up to peed with .NET

Any help greatly appreciated

Cheers
Dave
GeneralDisconnected Data: Help! Pin
Rommel the iCeMAn17-Nov-04 11:04
Rommel the iCeMAn17-Nov-04 11:04 
GeneralRe: Disconnected Data: Help! Pin
R. Thomas17-Nov-04 19:36
R. Thomas17-Nov-04 19:36 
GeneralRe: Disconnected Data: Help! Pin
Rommel the iCeMAn18-Nov-04 2:55
Rommel the iCeMAn18-Nov-04 2:55 
GeneralLook for custom Printing/Report Pin
AstronusX17-Nov-04 9:59
AstronusX17-Nov-04 9:59 
Generaladdins for photoshop Pin
shinay17-Nov-04 8:19
shinay17-Nov-04 8:19 
GeneralVisual Basic and Microsoft Access Pin
underb@asd20.org17-Nov-04 8:18
underb@asd20.org17-Nov-04 8:18 
GeneralOLD TAPI CONTROL Pin
John R. Shaw17-Nov-04 6:28
John R. Shaw17-Nov-04 6:28 
Generalproblem filling object properties (error: 'System.Reflection.TargetException: Object does not match target type') Pin
kobber17-Nov-04 6:23
kobber17-Nov-04 6:23 
GeneralReference dll not found ! Pin
ronenw17-Nov-04 5:07
ronenw17-Nov-04 5:07 
GeneralRe: Reference dll not found ! Pin
MohammadAmiry18-Nov-04 0:11
MohammadAmiry18-Nov-04 0:11 
GeneralRe: Reference dll not found ! Pin
ronenw20-Nov-04 19:47
ronenw20-Nov-04 19:47 
GeneralCreating a Help File Pin
cwayman17-Nov-04 5:02
cwayman17-Nov-04 5:02 
GeneralRe: Creating a Help File Pin
Rommel the iCeMAn18-Nov-04 3:10
Rommel the iCeMAn18-Nov-04 3:10 
GeneralIExtractImage... Pin
schweet_nectur17-Nov-04 3:57
schweet_nectur17-Nov-04 3:57 
GeneralPrint Dialog Pin
partt17-Nov-04 3:41
partt17-Nov-04 3:41 
GeneralRe: Print Dialog Pin
Dave Kreskowiak17-Nov-04 15:44
mveDave Kreskowiak17-Nov-04 15:44 
GeneralLPCTSTR Question Pin
SarahAmelia17-Nov-04 3:21
SarahAmelia17-Nov-04 3:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.