资源简介

c#TextBox自动带出联想功能(实现邮箱电话号码): 1.实现邮箱带出, 2.实现电话本带出,(可以添加自己相加入的电话,如:加入自己的通讯录,即可实现), 感谢大家的支持,VS2015源码。低版本也可以兼容。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

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

        private void Form1_SizeChanged(object sender EventArgs e)
        {
            textBox_Content.Width = Width - textBox_Content.Left - 20;
            textBox_Content.Height = Height - panel_Down.Height - 20;
            textBox_Email.Width = textBox_Content.Width - button_Send.Width - 10;
            textBox_Name.Width = textBox_Email.Width;
            button_Send.Left = textBox_Name.Left + textBox_Name.Width + 10;
        }

        private void textBox_Email_TextChanged(object sender EventArgs e)
        {
            string[] sEmail = new string[] { “@qq.com“ “@sina.com“ “@163.com“ “@163.net“ “@126.com“ “@vip.sina.com“ “@sina.cn“ “@gmail.com“
                “@yahoo.com“ “@msn.com“ “@hotmail.com“/* “@aol.com“ “@ask.com“ “@live.com“ “@263.net“ “@3721.net“*/};
            AutoCompleteStringCollection autoText = new AutoCompleteStringCollection();

            if (textBox_Email.Text.IndexOf(“@“) != -1)
            {
                textBox_Email.AutoCompleteSource = AutoCompleteSource.None;
            }
            else
            {
                textBox_Email.AutoCompleteSource = AutoCompleteSource.CustomSource;
            }
            foreach (string s in sEmail)
            {
                autoText.Add(textBox_Email.Text + s);
            }
            //源
            textBox_Email.AutoCompleteCustomSource = autoText;
            //弹出式
            textBox_Email.AutoCompleteMode = AutoCompleteMode.Suggest;
        }

        private void Form1_Load(object sender EventArgs e)
        {
            this.BackColor = Color.FromArgb(191 212 197);
        }
    }
}

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

    ..A..H.     41984  2019-07-16 10:01  TestAutoTextBox\.vs\TestAutoTextBox\v14\.suo

     文件        189  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\App.config

     文件      10752  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\bin\Debug\TestAutoTextBox.exe

     文件        189  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\bin\Debug\TestAutoTextBox.exe.config

     文件      22016  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\bin\Debug\TestAutoTextBox.pdb

     文件      22696  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\bin\Debug\TestAutoTextBox.vshost.exe

     文件        189  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\bin\Debug\TestAutoTextBox.vshost.exe.config

     文件        490  2010-03-17 22:39  TestAutoTextBox\TestAutoTextBox\bin\Debug\TestAutoTextBox.vshost.exe.manifest

     文件       2061  2019-07-16 10:00  TestAutoTextBox\TestAutoTextBox\Form1.cs

     文件       6853  2019-07-16 10:00  TestAutoTextBox\TestAutoTextBox\Form1.Designer.cs

     文件       5817  2019-07-16 10:00  TestAutoTextBox\TestAutoTextBox\Form1.resx

     文件        868  2019-07-16 09:57  TestAutoTextBox\TestAutoTextBox\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7236  2019-07-16 09:57  TestAutoTextBox\TestAutoTextBox\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2019-07-16 09:57  TestAutoTextBox\TestAutoTextBox\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2019-07-16 09:57  TestAutoTextBox\TestAutoTextBox\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2019-07-16 09:57  TestAutoTextBox\TestAutoTextBox\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        800  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\obj\Debug\TestAutoTextBox.csproj.FileListAbsolute.txt

     文件       1012  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\obj\Debug\TestAutoTextBox.csproj.GenerateResource.Cache

     文件      10752  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\obj\Debug\TestAutoTextBox.exe

     文件        180  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\obj\Debug\TestAutoTextBox.Form1.resources

     文件      22016  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\obj\Debug\TestAutoTextBox.pdb

     文件        180  2019-07-16 10:01  TestAutoTextBox\TestAutoTextBox\obj\Debug\TestAutoTextBox.Properties.Resources.resources

     文件        527  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\Program.cs

     文件       1338  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\Properties\AssemblyInfo.cs

     文件       2843  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\Properties\Resources.Designer.cs

     文件       5612  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\Properties\Resources.resx

     文件       1102  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\Properties\Settings.Designer.cs

     文件        249  2019-07-16 09:56  TestAutoTextBox\TestAutoTextBox\Properties\Settings.settings

     文件       3928  2019-07-16 09:58  TestAutoTextBox\TestAutoTextBox\TestAutoTextBox.csproj

     文件       1012  2019-07-16 09:57  TestAutoTextBox\TestAutoTextBox.sln

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

评论

共有 条评论