Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Alternate of listbox.itemdata property

Alternate of listbox.itemdata property

Scheduled Pinned Locked Moved Database
csharpjsonhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RaveRare
    wrote on last edited by
    #1

    dear every one in vb 6 i used listbox.itemdata property to recognize the selected item and its reference data into other tables to fill my controls when i click on one. please help me that in vb .net how i can deal with this. i mean that i want to click on a list item for example student name and the rest record should be filled in text boxes on the form. help plz

    J R 2 Replies Last reply
    0
    • R RaveRare

      dear every one in vb 6 i used listbox.itemdata property to recognize the selected item and its reference data into other tables to fill my controls when i click on one. please help me that in vb .net how i can deal with this. i mean that i want to click on a list item for example student name and the rest record should be filled in text boxes on the form. help plz

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      post the quetion in the appropriate forum...


      Regards
      John


      1 Reply Last reply
      0
      • R RaveRare

        dear every one in vb 6 i used listbox.itemdata property to recognize the selected item and its reference data into other tables to fill my controls when i click on one. please help me that in vb .net how i can deal with this. i mean that i want to click on a list item for example student name and the rest record should be filled in text boxes on the form. help plz

        R Offline
        R Offline
        Rupesh Kumar Swami
        wrote on last edited by
        #3

        hi, create following class in your application Public Class ListItemData Dim mstrText As String Dim mintIndex As Integer Public Sub New(ByVal Text As String, ByVal Index As Integer) mstrText = Text mintIndex = Index End Sub Public ReadOnly Property Index() As Integer Get Return mintIndex End Get End Property Public Overrides Function ToString() As String Return mstrText End Function End Class now use following code to fill listbox in your app to use above class str = "select f_id,f_name from facultylist" result = mdGlobalInstance.GetResultFromQuery(str) 'here result is dataset For i = 0 To result.Tables(0).Rows.Count - 1 lstFaculty.Items.Add(New ListItemData(result.Tables(0).Rows(i).Item(1), result.Tables(0).Rows(i).Item(0))) Next now get selected item of list box as following dim id as integer id=CType(LstFaculty.SelectedItem, ListItemData).Index hope this helps

        Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups