Assiging AxImageList to AxListView
-
Hi, When I tried to assign AxImageList to AxListView, I am getting "Invalid Object" error. Could any one of you please let me know how to do this. My code: Private WithEvents mLV As AxMSComctlLib.AxListView Public WithEvents imlLVSortIcons As AxMSComctlLib.AxImageList mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons Actually this code is converted from VB6 to VB.NET. Thanks in Advance,
AR Reddy
-
Hi, When I tried to assign AxImageList to AxListView, I am getting "Invalid Object" error. Could any one of you please let me know how to do this. My code: Private WithEvents mLV As AxMSComctlLib.AxListView Public WithEvents imlLVSortIcons As AxMSComctlLib.AxImageList mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons Actually this code is converted from VB6 to VB.NET. Thanks in Advance,
AR Reddy
Private WithEvents mLV As ??? AxMSComctlLib.AxListView mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons In the first line, you never create a new instance of mLV that's why you can't assign anything to one of it's properties. Replace ??? with New
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Private WithEvents mLV As ??? AxMSComctlLib.AxListView mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons In the first line, you never create a new instance of mLV that's why you can't assign anything to one of it's properties. Replace ??? with New
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Hi, Thanks for the reply, I have tried with New, but I am getting the same error "Invalid Object".
AR Reddy
Ok let's look at the code you gave Private WithEvents mLV As AxMSComctlLib.AxListView Public WithEvents imlLVSortIcons As AxMSComctlLib.AxImageList mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons 1) the new is required for mLV so put that back in. 2) You aren't using imlLVsortIcons is that your intention? 3) which form are you in because you mention a form frmmain? 4) is definstance of frmmain created?
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Ok let's look at the code you gave Private WithEvents mLV As AxMSComctlLib.AxListView Public WithEvents imlLVSortIcons As AxMSComctlLib.AxImageList mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons 1) the new is required for mLV so put that back in. 2) You aren't using imlLVsortIcons is that your intention? 3) which form are you in because you mention a form frmmain? 4) is definstance of frmmain created?
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
Hi nlarson, Many thanks for the replies, Here is my actual code, Private WithEvents mLV As AxMSComctlLib.AxListView Public Sub Constructor(ByRef LV As AxMSComctlLib.AxListView, Optional ByRef LVWrapper As cListViewWrapper = Nothing) mLV = LV ...... mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons ...... ...... End Sub 1) i can put back the New for mLV 2) Yes, im not using imlVVSortIcons in this form, i want to use mLV 3) frmMain is the main form which contains the imlLVSortIcons image list. And the above code is in different form. 4) Yes, I have created the definstance in frmMain. Thanks,
AR Reddy
-
Hi nlarson, Many thanks for the replies, Here is my actual code, Private WithEvents mLV As AxMSComctlLib.AxListView Public Sub Constructor(ByRef LV As AxMSComctlLib.AxListView, Optional ByRef LVWrapper As cListViewWrapper = Nothing) mLV = LV ...... mLV.ColumnHeaderIcons = frmMain.DefInstance.imlLVSortIcons ...... ...... End Sub 1) i can put back the New for mLV 2) Yes, im not using imlVVSortIcons in this form, i want to use mLV 3) frmMain is the main form which contains the imlLVSortIcons image list. And the above code is in different form. 4) Yes, I have created the definstance in frmMain. Thanks,
AR Reddy
is typeof(columnheadericons) = imllvsorticons? if your getting somekind of object not set then you'll need to check each one If lv is nothing then msgbox("it's lv") If frmmain is nothing then msgbox("it's frmmain") If frmmain.definstance is nothing then msgbox("it's frmmain.definstance") otherwise ????????????
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous