List box problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bonzol

    #1

    List box problem

    Vb.Net 2003 Web

    Hey there, I am trying to do the simple task of displaying a value or
    an index of a selected item in a listbox via

    Label5.Text = CStr(lstfileBox .SelectedIndex)

    and or

    Label5.Text = lstfileBox.Sele ctedValue

    To fill the listbox I use this


    Dim windir As String
    Dim file As String

    windir = Server.MapPath( "Files")
    lstfileBox.Item s.Clear()
    Dim files() As String = Directory.GetFi les(windir)

    For Each file In files
    lstfileBox.Item s.Add(System.IO .Path.GetFileNa me(file))
    Next



    The box fills fine, and has all the files listed. However, when I try
    to display the selected index I always get "-1" and whenever I try and
    display the value, I always get "",, nothing at all.

    Anyone have any suggestions?
    Thanx in advance

  • Bonzol

    #2
    Re: List box problem

    .....Continued


    However, If I do

    Label5.Text = lstfileBox.Item s(0).Value()

    that works. But Thats no use to me

    Comment

    Working...