Windows Develop Bookmark and Share   
 index > Windows Forms Designer > ListView Selected Property Error
 

ListView Selected Property Error

Hi,

I have tried the below sentance to select the first row of the listview while loading this listview.

lviwQuality_DqInfos.Items(Me.m_Quality_DqInfoIndex).Selected = True

But the above sentence gives me an error "Object reference not set to an instance of an object.".

I have tried so many times but failed to find its solution.

Please help me ASAP.

Thanks.

Regards Ashlesh,
Ashlesh Patel  Friday, April 03, 2009 7:20 AM

Hi Ashlesh,

It seems that when the above line of code is being executed, the item of index "m_Quality_DqInfoIndex" doesn't exist.

Call this line of code AFTER all the items have been added to theListView.

Hope this helps.

Linda Liu

Linda Liu  Thursday, April 09, 2009 8:39 AM

Hi Ashlesh,

It seems that when the above line of code is being executed, the item of index "m_Quality_DqInfoIndex" doesn't exist.

Call this line of code AFTER all the items have been added to theListView.

Hope this helps.

Linda Liu

Linda Liu  Thursday, April 09, 2009 8:39 AM

You can use google to search for other answers

Custom Search

More Threads

• Relating Combos on Windows Forms
• How to get point from charindex in textbox
• BehaviorService Errors / Questions
• The Desiner Code
• Custom property editor from external assembly
• Custom control and specific 'DockArea', like GroupBox
• what the heck? Clicked on the background image property of a form, and everything went haywire!
• Saving/Retrieving changes made in the propertygrid control.
• Databinding
• Who lower a automatic scrollbar in a ListView