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; } }
public ChangePasswordForm(DashboardForm dashboardForm) { InitializeComponent(); this.dashboardForm = dashboardForm; this.Show(); dashboardForm.Hide(); db = new VoterRecordsEntities(); }