Re: Possible ListView bug and ArgumentOutOfRangeException

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Matt Burland (wjousts_at_[no)
Date: 07/22/04


Date: Thu, 22 Jul 2004 16:42:51 -0500

You can wrap the problem statement with:

if (!this.DesignMode)
{
     // problem statements
}

To prevent it from trying to do things during design that it can't do. The
problem is probably that the ListView at design time doesn't contain any
data and yet is trying to execute your ListView.Items(0).EnsureVisible (not
possible because Items(0) doesn't exist!).

"Mike" <mberger@skypoint.com> wrote in message
news:c3654e90.0407221244.7d959930@posting.google.com...
> I have a form with a ListView and a timer.
> The timer fires,
> sets Timer1.Enabled = False
> and fills up the ListView with data.
>
> While I'm filling up the ListView, at particular times, I do a
> ListView.Items(xxx).EnsureVisible - I do this to cause the ListView to
> scroll and give some activity to the UI. At the end of the routine, I
> do a
> ListView.Items(0).EnsureVisible
> to scroll back to the first entry.
>
> All that works, then I created another form and inherit from the
> previous form. Using the IDE (the development environment, not runtime
> !!!! ) I sporadically get a messagebox, with the
> ArgumentOutOfRangeException and complaining that the displayIndex of 0
> is illegal. If I comment out the ListView.Items(0).EnsureVisible line,
> the error seems to go away. Anyone have any ideas ? This is my first
> attempt at .net, so I may be all wet too ...
>
> Mike



Relevant Pages

  • RE: ListView Problem
    ... I am not sure if this is a bug or if it is by design but it seems that the ... assigned the context menu to the ListView.ContextMenu property. ... > global exception handler and therefore it did not catch the problem. ... > Listview was making a call to get_itembased on the stack ...
    (microsoft.public.dotnet.framework)
  • Re: TListView initialization during FormCreate
    ... > The listview has items added during design. ... > be initialized with the design data once it's finished, ... > what magical event triggers the listview initialization for future ...
    (comp.lang.pascal.delphi.misc)
  • Re: ListView Control
    ... I have tried both -1 and -2 and they only seem to be working with a listview ... > I was mainly following the example for the ListView control in the MSDN as ... > seemed to work ok if I created the control in code rather than at Design ... >> Regards, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: OOAD Study Guide
    ... I realized OOAD is not easy to implement in real time ... > define the problem statement myself, because I afraid I will fallback ... > trying to analysis and design the system.. ... The Mindprod server is down right now, ...
    (comp.object)
  • Re: OOAD Study Guide
    ... Bob ... I realized OOAD is not easy to implement in real time ... > define the problem statement myself, because I afraid I will fallback ... > trying to analysis and design the system.. ...
    (comp.object)