newb help

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

    #1

    newb help

    Hello,

    I'm storing my student objects in a list box and using the displaymember to
    display to display the student first name and lastname.

    lstStudents.Dis playMember = "LastFirst"

    Dim tmpStudent As Student
    For Each tmpStudent In mStudents
    lstStudents.Ite ms.Add(tmpStude nt)
    Next
    lblCount.Text = mStudents.Count .ToString()

    Now i need to extract the objects from the list based on user selection. I
    know it has something to do with selecteditem but cant figure it out.

    Help is appreciated

    thanks


  • Ken Tucker [MVP]

    #2
    RE: newb help

    Hi,

    Dim tmpStudent As Student

    Try
    tmpStudent = Ctype(lstStuden ts.selecteditem ,student)
    catch
    ' error getting data
    end try

    Ken
    ----------------------------------
    "Troy" wrote:
    [color=blue]
    > Hello,
    >
    > I'm storing my student objects in a list box and using the displaymember to
    > display to display the student first name and lastname.
    >
    > lstStudents.Dis playMember = "LastFirst"
    >
    > Dim tmpStudent As Student
    > For Each tmpStudent In mStudents
    > lstStudents.Ite ms.Add(tmpStude nt)
    > Next
    > lblCount.Text = mStudents.Count .ToString()
    >
    > Now i need to extract the objects from the list based on user selection. I
    > know it has something to do with selecteditem but cant figure it out.
    >
    > Help is appreciated
    >
    > thanks
    >
    >
    >[/color]

    Comment

    • Troy

      #3
      Re: newb help

      thanks

      "Ken Tucker [MVP]" <KenTuckerMVP@d iscussions.micr osoft.com> wrote in message
      news:507125DB-7C6A-4926-9F03-7B85E5475B6A@mi crosoft.com...[color=blue]
      > Hi,
      >
      > Dim tmpStudent As Student
      >
      > Try
      > tmpStudent = Ctype(lstStuden ts.selecteditem ,student)
      > catch
      > ' error getting data
      > end try
      >
      > Ken
      > ----------------------------------
      > "Troy" wrote:
      >[color=green]
      >> Hello,
      >>
      >> I'm storing my student objects in a list box and using the displaymember
      >> to
      >> display to display the student first name and lastname.
      >>
      >> lstStudents.Dis playMember = "LastFirst"
      >>
      >> Dim tmpStudent As Student
      >> For Each tmpStudent In mStudents
      >> lstStudents.Ite ms.Add(tmpStude nt)
      >> Next
      >> lblCount.Text = mStudents.Count .ToString()
      >>
      >> Now i need to extract the objects from the list based on user selection.
      >> I
      >> know it has something to do with selecteditem but cant figure it out.
      >>
      >> Help is appreciated
      >>
      >> thanks
      >>
      >>
      >>[/color][/color]


      Comment

      Working...