3, customer selection module design
The customer selection module is used to provide a choice for an existing user, where a ListBox control on the left shows all customers that have been added, with a ListBox on the right to display the selected customer, with a maximum of two customers selected at a time. You then also need to add a person property that returns the parent form to which the selected people are assigned.
Examples of customer selection module designs are:
Load the public class and create the person property with the code:
<span style= "FONT-SIZE:18PX;" >common cm = new common ();//Create public class common object private string _person; public string person//Set property value { get { return _person;//value } set { _person = value;// Set Value } }</span>
The complete customer selection form code is:
<span style= "FONT-SIZE:18PX;" >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;using System.data.sqlclient;//introduced namespaces namespace client Management System {public partial class Clientselect:form {Common cm = new C Ommon ();//Create public class common object private string _person; public string person//Setting property value {get {return _person;//} set {_person = value;//set Value}} public Clientselect ()//constructor { InitializeComponent ();//Initialize clientselect form} private void Clientselect_load (object sender, Eventar GS e)//clientselect form Load event {Cm.bindlistbox (lballclient, "Select Id,username from Customer ORDER by ID ASC "); private void Button2_Click (object sender, EventArgs e)//&The gt;> button's Click event {if (lballclient.selectedindex!=-1)//determines the selected item {if (LBSELECTC Lient. ITEMS.COUNT<2)//Judge already item {LBSELECTCLIENT.ITEMS.ADD (Lballclient.text);//Add } else {MessageBox.Show ("add up to two customers at a time"); }} else {MessageBox.Show ("Please select a customer to add! "); }} private void Button3_Click (object sender, EventArgs e)//<< button's Click event {if (Lbsel ECTCLIENT.SELECTEDINDEX!=-1)//Determines whether the item {lbSelectClient.Items.RemoveAt (Lbselectclient.selectedin) is selected DEX); } else {MessageBox.Show ("Please select the customer you want to remove!") "); }} private void Button1_Click (object sender, EventArgs e)//Determines the button's Click event {person = ""; for (int i = 0; i < LbSelectClient.Items.Count; i++)//Traverse selectedoption {person + = lbselectclient.items[i]. ToString () + ",";//Assignment}}}}</span>
Run the entire program to the Customer Selection window:
(1) Click on a customer name in all customers and then click the >> button to select the customer name that appears in the customer:
(2) Click Select a customer name in the customer, then click the << button to select the customer to remove the selected customer Name:
(3) Select the customer you want to select, click OK, the last textbox appears in the name of the customer you want to select:
Probably the entire customer management system module design is basically completed, if you want to add other forms and features can also be based on customer needs to add and design, as a simple customer management system basically roughly these. Module design is complete.
Module design of customer management system (10)