Results 1 to 5 of 5

Thread: Listview Items

  1. #1

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92

    Exclamation Listview Items

    Can anyone help me i am new to .Net and i can't get this working?

    i have a listview which has been populated from a dataset and i want to load the data into text boxes i can get row 0 to load but i want to have it so if i click on row 3 for example it puts row 3's data in to the text boxes.

    Please tell me if i'm going wrong or if i'm just stupid!!

    if i change the Rows(0) bit the different rows that works but i want it to change when i select the row.

    Here is my code

    txtUsername.Text = dsUser.Tables("User").Rows(0). Item("Username")
    txtUsername.Enabled = False
    txtFirstName.Text = dsUser.Tables("User").Rows(0). Item("FirstName")
    txtUserInitial.Text = dsUser.Tables("User").Rows(0). Item("MiddleInitial")
    txtSurname.Text = dsUser.Tables("User").").Rows(0).Item("Surname")
    txtAssetNo.Text = dsUser.Tables("User").").Rows(0).Item("AssetNumber")
    txtEmail.Text = dsUser.Tables("User").").Rows(0).Item("EmailAddress")
    cboUserLocation.Text = dsUser.Tables("User").").Rows(0).Item("Branch")
    cboUserFloor.Text = dsUser.Tables("User").").Rows(0).Item("Floor")
    Last edited by nokia8210; Sep 18th, 2003 at 09:35 AM.

  2. #2

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    *Bump*

  3. #3
    Addicted Member
    Join Date
    Mar 2001
    Location
    Devon, UK
    Posts
    181
    put this in the click or selectedindexchange event of the listview
    Your text box.text = listview.selecteditem(0).subitems(which ever colum).text

    Bit confused by your code?? Looks like you are loading from a dataset?
    Wind and waves resolves all problems.

  4. #4

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    sorry yes i am thanks will try

  5. #5

    Thread Starter
    Lively Member nokia8210's Avatar
    Join Date
    Dec 2002
    Location
    Coventry
    Posts
    92
    sorry it doesn't work say's " 'SelectedItem' is not a member of 'system.windows.forms.listview' "

    any other idea's??

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