usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespace_15._13datagridview Cell Auto-fill { Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); } Private voidForm1_Load (Objectsender, EventArgs e) { //TODO: This line of code loads the data into the table "csharpzxwdataset.mytable001". You can move or delete it as needed. This. Mytable001tableadapter.fill ( This. csharpzxwdataset.mytable001); } Private voidDatagridview1_editingcontrolshowing (Objectsender, Datagridvieweditingcontrolshowingeventargs e) { stringTitleText =Datagridview1.columns[datagridview1.currentcell.columnindex]. HeaderText; if(Titletext.equals ("Department") {TextBox AutoText= E.control asTextBox; if(AutoText! =NULL) {Autotext.autocompletemode=autocompletemode.suggest; Autotext.autocompletesource=Autocompletesource.customsource; AutoCompleteStringCollection datacollection=NewAutoCompleteStringCollection (); Datacollection.add ("Development Department"); Datacollection.add ("Sales Department"); Datacollection.add ("Technical Support Department"); Datacollection.add ("Finance Department"); Autotext.autocompletecustomsource=datacollection; } } } }}
15.13DataGridView Cell Auto-fill