none
Listbox control in Visual Web Developer not working correctly

    Question

  • Not sure where to post this issue.  I am developing a web app using Visual Web developer. I have created an .aspx page where I have placed a listbox control on the page and populate it when the page loads.  When I select an item from the list the listindex value is always -1.  I can never get the index for the other values.  I've used the following code,but get the same results:

    For i = 0 To ListBox1.Items.Count - 1
        If ListBox1.Items(i).Selected = True Then
            val= ListBox1.Items(i).Value 
        End If
    Next

    val=nothing, listindex is -1 when i check

    Any idea how to get around this issue?

    Thx

    • Moved by Just KarlModerator Tuesday, February 10, 2015 4:39 PM Looking for the proper forum.
    Thursday, February 05, 2015 9:21 PM

Answers

  • Hello,

    This should be asked in Microsoft's ASP.Net forums:

    http://forums.asp.net/

    As Microsoft's ASP.Net forums are on a different platform, we cannot move the question for you.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Tuesday, February 10, 2015 4:39 PM
    Moderator

All replies

  • Hello,

    The TechNet Sandbox forum is designed for users to try out the new forums functionality. Please be respectful of others, and do not expect replies to questions asked here.

    As it's off-topic here, I am moving the question to the Where is the forum for... forum.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Tuesday, February 10, 2015 4:39 PM
    Moderator
  • Hello,

    This should be asked in Microsoft's ASP.Net forums:

    http://forums.asp.net/

    As Microsoft's ASP.Net forums are on a different platform, we cannot move the question for you.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Tuesday, February 10, 2015 4:39 PM
    Moderator
  • I finally figured it out myself.
    Thursday, February 19, 2015 3:45 AM