コード例 #1
0
        public AddRecordForm(DashboardForm dashboardForm, taskToPerform task, int voterID)
        {
            InitializeComponent();
            this.dashboardForm = dashboardForm;
            this.Show();
            dashboardForm.Hide();
            db = new VoterRecordsEntities();
            db.Logins.FirstOrDefault();
            this.task    = task;
            this.voterID = voterID;
            if (voterID != -1)
            {
                FillFormFromDatabase();
            }

            using (VoterRecordsEntities db = new VoterRecordsEntities())
            {
                AutoCompleteStringCollection source = new AutoCompleteStringCollection();

                var listNames = db.Voters.Select(x => x.address).ToList();

                foreach (string name in listNames)
                {
                    source.Add(name);
                }
                txtAddress.AutoCompleteCustomSource = source;
            }
        }
コード例 #2
0
 public ChangePasswordForm(DashboardForm dashboardForm)
 {
     InitializeComponent();
     this.dashboardForm = dashboardForm;
     this.Show();
     dashboardForm.Hide();
     db = new VoterRecordsEntities();
 }