CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: TopIndex = 0?

  1. #1
    Join Date
    Dec 2003
    Location
    St. Cugat - Catalunya
    Posts
    441

    TopIndex = 0?

    Recently I discovered that assigning a value to a list box item resets TopIndex to zero.

    ListBox1.Items.Item(n) = "Something" '... implies .... ListBox1.TopIndex = 0

    This seems a little bit incongruent with other situations, for instance,

    ListBox1.Items.Add("Something")

    doesn't modify TopIndex.

    Obviously I can get/reset the value

    PrevIndex = ListBox1.TopIndex
    ListBox1.Items.Item(n) = "Something"
    ListBox1.TopIndex = PrevIndex

    but, is there any way to avoid it?

    Thanks
    Did it help? rate it.

    The best conversation I had was over forty million years ago ... and that was with a coffee machine.

  2. #2
    Join Date
    Nov 2004
    Location
    Poland
    Posts
    1,355

    Re: TopIndex = 0?

    is there any way to avoid it?
    IMHO NO.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured