Results 1 to 7 of 7

Thread: [RESOLVED] listbox modification

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    67

    Resolved [RESOLVED] listbox modification

    Hi,
    how to replace selected item in the listbox with the value in textbox?

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: listbox modification

    List1.List(List1.ListIndex) =

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: listbox modification

    Code:
    Private Sub Command1_Click()
        If List1.ListIndex <> -1 Then 'ensure an item is selected
            List1.List(List1.ListIndex) = Text1.Text
        End If
    End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    67

    Re: listbox modification

    after i select the item in listbox in form3, i clicked button that shows form5 with one textbox to enter the replacing value.After this i clicked button in form5 that should replace the value in the form3.listbox with the value form5.textbox..this is the code i used in the buttton event of form5.
    vb Code:
    1. Form3.List1.list(List1.ListIndex) = Form5.Text1.Text
    but i gets an error "object required"...

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    67

    Re: listbox modification

    after i select the item in listbox in form3, i clicked button that shows form5 with one textbox to enter the replacing value.After this i clicked button in form5 that should replace the value in the form3.listbox with the value form5.textbox..this is the code i used in the buttton event of form5.
    vb Code:
    1. Form3.List1.list(List1.ListIndex) = Form5.Text1.Text
    but i gets an error "object required"... pls help me out

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: listbox modification

    (List1.ListIndex) that would mean that List1 is on Form5... everywhere that you reference a control from another Form you have to preceed it with form name

    Form3.List1.List(Form3.List1.ListIndex) = Form5.Text1.Text

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    67

    Re: listbox modification

    thank you....its working

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