// on form load private void Main_Form_Load(object sender, EventArgs e) { // display image on the panel ( close and minimize ) panel4.BackgroundImage = Image.FromFile("../../images/img3.png"); GROUP group = new GROUP(); // populate combobox with the logged user groups comboBoxGroup.DataSource = group.getGroups(Globals.GlobalUserId); comboBoxGroup.DisplayMember = "name"; comboBoxGroup.ValueMember = "id"; }
private void Contacts_Full_List_Form_Load(object sender, EventArgs e) { // display image on the panel ( close and minimize ) panel4.BackgroundImage = Image.FromFile("../../images/img4.png"); DataGridViewImageColumn picCol = new DataGridViewImageColumn(); dataGridView1.RowTemplate.Height = 80; CONTACT contact = new CONTACT(); //SqlCommand command = new SqlCommand("SELECT [mycontact].fname as FirstName, [mycontact].lname as LastName, [mygroups].name as Group, phone, email, address, pic FROM [mycontact] INNER JOIN [mygroups] on [mycontact].group_id = [mygroups].id WHERE [mycontact].userid = @userid"); SqlCommand command = new SqlCommand("SELECT [mygroups].name as GroupName,fname as FirstName, lname as LastName, phone, email, address, pic FROM [mycontact] INNER JOIN [mygroups] on [mycontact].group_id = [mygroups].id WHERE [mycontact].userid = @userid"); command.Parameters.AddWithValue("@userid", Globals.GlobalUserId); dataGridView1.DataSource = contact.SelectContactList(command); picCol = (DataGridViewImageColumn)dataGridView1.Columns[6]; picCol.ImageLayout = DataGridViewImageCellLayout.Stretch; for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (IsOdd(i)) { dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.WhiteSmoke; } } GROUP group = new GROUP(); listBox1.DataSource = group.getGroups(Globals.GlobalUserId); listBox1.DisplayMember = "name"; listBox1.ValueMember = "id"; listBox1.SelectedItem = null; dataGridView1.ClearSelection(); }