Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6796673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:30:59+00:00 2026-05-26T18:30:59+00:00

I am working with a simple address book in which i have separate lists

  • 0

I am working with a simple address book in which i have separate lists for companies and persons on a single window form. I have a problem when i selected an item from first listview it shows values for item from second list..i am beginner in programming languages. I also have a single list and a single xml file to save contacts for both listviews. Could some1 help me…? thanx in advance.
i have this code in Selected index changed event

  try
  {
       textBox1.Text = contacts[listView1.SelectedItems[0].Index].FullName;
       textBox2.Text = contacts[listView1.SelectedItems[0].Index].Address1;
       textBox3.Text = contacts[listView1.SelectedItems[0].Index].Address2;                    
       textBox5.Text = contacts[listView1.SelectedItems[0].Index].Phone1;
       textBox6.Text = contacts[listView1.SelectedItems[0].Index].Phone2;
       textBox7.Text = contacts[listView1.SelectedItems[0].Index].Phone3;
       textBox8.Text = contacts[listView1.SelectedItems[0].Index].Email;
       textBox11.Text = contacts[listView1.SelectedItems[0].Index].Website;

   }
   catch { }

ad other list have

    textBox1.Text = contacts[listView2.SelectedItems[0].Index].FullName;                
     textBox3.Text = contacts[listView2.SelectedItems[0].Index].Address2;
     textBox4.Text = contacts[listView2.SelectedItems[0].Index].MailingAddress;
     textBox5.Text = contacts[listView2.SelectedItems[0].Index].Phone1;                
     textBox8.Text = contacts[listView2.SelectedItems[0].Index].Email;
     textBox11.Text = contacts[listView2.SelectedItems[0].Index].Website;
     textBox9.Text = contacts[listView2.SelectedItems[0].Index].ContactPerson;
     textBox10.Text = contacts[listView2.SelectedItems[0].Index].ContactPhone;

(please dont laugh i am just a beginner:))

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:31:00+00:00Added an answer on May 26, 2026 at 6:31 pm

    well both peices of code are pulling from the same contacts array.. which you are accessing by INDEX.. and keyed to the INDEX of the selected listviewitem. That means that when you select the first item in listview1 you will get an index of ZERO.. and when you select the first item in listview2 you will get an index of ZERO.. effectively giving you the same contacts element.

    I would recommend setting the .Tag property of each listviewitem as you populate it to the contact that it represents (eg. listviewitem item = listview1.items.add(contacts[index].FullName; item.Tag = contacts[index]; )

    Then you can ask for the contact by reference in your selecteditemchanged event: contact contact = listview1.selectedItems[0].Tag;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have developed a simple php contact form, that's working fine, but i am
I'm working on a simple multiplayer game in which 2-4 players are placed at
i am working on a simple web app which has a user model and
I'm working on a simple javascript login for a site, and have come up
I am working on a simple CAD program which uses OpenGL to handle on-screen
I am working on building a simple proxy which will log certain requests which
I am working on my second CI application. I have created some simple CRUD
I have a simple form that uses jQuery validation to notify the user of
I'm working on an Address Book application in C++. I need to store the
I'm working on a simple login form. When the user clicks on the Login

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.