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 8680521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:16:22+00:00 2026-06-12T21:16:22+00:00

I have been working with a c# tutorial for beginners to create an address

  • 0

I have been working with a c# tutorial for beginners to create an address book. I followed the instructions, and I have encountered two problems.

  1. When I select the properties of the Listview box the SelectedIndexChanged event is missing. I have restarted and refreshed the program several times. I have wrote directly to the file, and it is still not present.

  2. When selecting a contact from the list, the text boxes do not reflect the selection. I suspect that this is related to the absence of the SelectedIndexChanged event in the ui. This persisted even when I set SelectedIndexChanged event in code.

All help would be greatly appreciated. My code is below

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Web;


namespace AddressBook
{
    public partial class AddressBook : Form
    {
        public AddressBook()
        {
            InitializeComponent();
        }

        List<Person> people = new List<Person>();

        private void AddressBook_Load(object sender, EventArgs e)
        {
            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            if (!Directory.Exists(path + "\\Address Book - Joe"))
                Directory.CreateDirectory(path + "\\Address Book - Joe");
            if (!File.Exists(path + "\\Address Book - Joe\\settings.xml"))
                File.Create((path + "\\Address Book - Joe\\settings.xml"));
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            Person p = new Person();
            p.FirstName = txtFName.Text;
            p.Address = txtAddress.Text;
            p.City = txtCity.Text;
            p.State = comboState.Text;
            p.ZipCode = txtZip.Text;
            p.Email = txtEmail.Text;
            p.PhoneNumber = txtPhone.Text;
            p.Additional = rtxtAdd.Text;
            people.Add(p);
            listView1.Items.Add(p.FirstName);
            txtFName.Text = "";
            txtAddress.Text = "";
            txtCity.Text = "";
            comboState.Text = "";
            txtZip.Text = "";
            txtEmail.Text = "";
            txtPhone.Text = "";
            rtxtAdd.Text = "";

        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtFName.Text = people[listView1.SelectedItems[0].Index].FirstName;
            txtAddress.Text = people[listView1.SelectedItems[0].Index].Address;
            txtCity.Text = people[listView1.SelectedItems[0].Index].City;
            comboState.Text = people[listView1.SelectedItems[0].Index].State;
            txtZip.Text = people[listView1.SelectedItems[0].Index].ZipCode;
            txtEmail.Text = people[listView1.SelectedItems[0].Index].Email;
            txtPhone.Text = people[listView1.SelectedItems[0].Index].PhoneNumber;
            txtZip.Text = people[listView1.SelectedItems[0].Index].ZipCode;
            rtxtAdd.Text = people[listView1.SelectedItems[0].Index].Additional;

        }

        private void txtFName_TextChanged(object sender, EventArgs e)
        {

        }
    }

    public class Person
    {
        public string FirstName { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string ZipCode { get; set; }
        public string PhoneNumber { get; set; }
        public string Email { get; set; }
        public string Additional { get; set; }
    }
}
  • 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-06-12T21:16:24+00:00Added an answer on June 12, 2026 at 9:16 pm

    You need to click the lightning-bolt icon in the Properties window to go to the Events tab.
    There, you will see the SelectedIndexChanged event (assuming you selected the right control.

    You need to bind your handler to that event in order for your code to run.

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

Sidebar

Related Questions

I have been working off a tutorial on Net Tuts to create a contact
I have been working through the tutorial adapting it to a project I want
I have been working on getting a mail app to work from a tutorial
I have been working off of a tutorial of a tower defence game( http://www.guahanweb.com/2009/01/31/tower-defense-in-as3-part-iv/
I have been working through the tutorial by Alex Young on using flash messages
So I have been working on a Clojure tutorial and it's pretty fun so
I am new to asp.net and have been working through the tutorial - up
I have been working through a tutorial ( http://glacialflame.com/category/tutorial/ ) to build an Isometric
I have been working on the official tutorial for ZF2 . At the end
I have been following this great tutorial and got my codes to working with

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.