• 大小: 214KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-26
  • 语言: C#
  • 标签: C#  通讯录  

资源简介

适合初学者借鉴的窗体程序,一定要看源码啊,这样才能学到东西

资源截图

代码片段和文件信息

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;

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

        string groupName;
        private void bt_check_Click(object sender EventArgs e)
        {
            string filename = “E:\\notebook\\“+tb_name.Text.Trim()+“.txt“;
            if (File.Exists(filename))
            {
                StreamReader fr = File.OpenText(filename);
                string str = fr.ReadLine();
                tb_name.Text = str;
                tb_address.Text = fr.ReadLine();
                tb_phone.Text = fr.ReadLine();
                tb_qq.Text = fr.ReadLine();
                tb_mail.Text = fr.ReadLine();
                if (fr.ReadLine() == “同学“)
                {
                    rb_classmate.Checked = true;
                }
                else
                {
                    if (fr.ReadLine() == “同事“)
                    {

                        rb_workmate.Checked = true;
                    }
                    else
                    {
                        if (fr.ReadLine() == “朋友“)
                        {
                            rb_friend.Checked = true;
                        }
                        else
                        {
                            rb_family.Checked = true;
                        }
                    }
                }

                fr.Close();
            }
            else
            {
                MessageBox.Show(“您要查找的联系人不存在,请确定已正确填写联系人姓名!“ “查看“);
            }
            
        }//查看联系人信息;

        private void bt_add_Click(object sender EventArgs e)
        {
            string filename = @“E:\notebook\“;
            filename = filename + tb_name.Text.Trim()+“.txt“;
            if (File.Exists(filename))
            {
               DialogResult result= MessageBox.Show
                   (“您要添加的联系人已存在!是否继续添加?““添加“MessageBoxButtons.OKCancel);
               if (result == DialogResult.OK)
               {
                   writeIn(filename);
               }
                Clear();
      
            }
            else
            {
                try
                {
                    writeIn(filename);
                 
                    MessageBox.Show(“联系人添加成功!““添加“);
                    Clear();
                }
                catch (IOException ex)
                {
                    MessageBox.Show(ex.ToString());

                }
           
            }//添加联系人信息;

        }//添加联系人

        private void bt_delete_Click(object sender EventArgs e)
        {
            string filename = “E:\\notebook\\“ + tb_name.Text.ToString().Trim() + “.txt“;   
    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      16384  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\app.publish\Application Files\WinFormsAdressBook_1_0_0_4\WinFormsAdressBook.exe.deploy

     文件       7339  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\app.publish\Application Files\WinFormsAdressBook_1_0_0_4\WinFormsAdressBook.exe.manifest

     文件     461824  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\app.publish\setup.exe

     文件       5438  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\app.publish\WinFormsAdressBook.application

     文件       1607  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\WinFormsAdressBook.application

    .CA....     16384  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\WinFormsAdressBook.exe

     文件       3589  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\WinFormsAdressBook.exe.manifest

    .CA....     32256  2011-09-26 15:59  WinFormsAdressBook\bin\Debug\WinFormsAdressBook.pdb

     文件       1607  2011-09-26 15:53  WinFormsAdressBook\bin\Debug\WinFormsAdressBook.vshost.application

    .CA....     14328  2011-09-26 15:57  WinFormsAdressBook\bin\Debug\WinFormsAdressBook.vshost.exe

     文件       5486  2011-09-26 16:14  WinFormsAdressBook\Form1.cs

     文件      21614  2011-09-26 15:42  WinFormsAdressBook\Form1.Designer.cs

     文件       6021  2011-09-26 15:42  WinFormsAdressBook\Form1.resx

     文件       1607  2011-09-26 15:59  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.application

    .CA....      1103  2011-09-26 15:57  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.csproj.FileListAbsolute.txt

     文件        847  2011-09-26 15:44  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.csproj.GenerateResource.Cache

    .CA....     16384  2011-09-26 15:59  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.exe

     文件       3589  2011-09-26 15:59  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.exe.manifest

    .CA....       180  2011-09-26 15:59  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.Form1.resources

    .CA....     32256  2011-09-26 15:59  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.pdb

    .CA....       180  2011-09-26 15:59  WinFormsAdressBook\obj\Debug\WinFormsAdressBook.Properties.Resources.resources

    .CA....       499  2011-03-30 21:17  WinFormsAdressBook\Program.cs

    .CA....      1378  2011-03-30 13:57  WinFormsAdressBook\Properties\AssemblyInfo.cs

    .CA....      2886  2011-03-30 13:57  WinFormsAdressBook\Properties\Resources.Designer.cs

    .CA....      5612  2011-03-30 13:57  WinFormsAdressBook\Properties\Resources.resx

    .CA....      1103  2011-03-30 13:57  WinFormsAdressBook\Properties\Settings.Designer.cs

    .CA....       249  2011-03-30 13:57  WinFormsAdressBook\Properties\Settings.settings

    .CA....      5793  2011-09-26 16:16  WinFormsAdressBook\WinFormsAdressBook.csproj

     文件        485  2011-09-26 16:16  WinFormsAdressBook\WinFormsAdressBook.csproj.user

     文件       1724  2011-09-26 15:47  WinFormsAdressBook\WinFormsAdressBook_TemporaryKey.pfx

............此处省略14个文件信息

评论

共有 条评论