Example DataGridView like Outlook...
-
Hi to all, I want to program a AGENDA like outlook for my appointments. I want to use drag & drop for modify appointments and make click over a cell and to create a new one. Can anybody help me or guide me? Thanks a lot.
_______ NaOH
-
how about you start programming it and we can guide you from there?
The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!
Hi velkropie, i want to use de datagridview control to make a personal agenda. It is like Outlook format. To create appointments, drag and drop across the cells, and this new controls (appointments, 'citas' in spanish) can be stored in a database. I begin with Visual Studio 2005 and the datagridview control. I need code examples to built this grid, format it and to insert new controls (labels for example) in the grid and a database. Thanks a lottt.
_______ NaOH
-
Hi velkropie, i want to use de datagridview control to make a personal agenda. It is like Outlook format. To create appointments, drag and drop across the cells, and this new controls (appointments, 'citas' in spanish) can be stored in a database. I begin with Visual Studio 2005 and the datagridview control. I need code examples to built this grid, format it and to insert new controls (labels for example) in the grid and a database. Thanks a lottt.
_______ NaOH
here is you drag and drop to get you started
void grdCampaigns_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo info = grdCampaigns.HitTest(e.X, e.Y); if (info.RowIndex >= 0) { DataRowView view = (DataRowView) grdCampaigns.Rows[info.RowIndex].DataBoundItem; if (view != null) grdCampaigns.DoDragDrop(view, DragDropEffects.Copy); } } }
void lstCategories_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
Collapsevoid lstCategories_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(DataRowView))) { // Determine which category the item was draged to Point p = lstCategories.PointToClient(new Point(e.X,e.Y)); int index = lstCategories.IndexFromPoint(p); if (index >= 0) { // Get references to the category and campaign DataRowView category = (DataRowView)lstCategories.Items[index]; DataRowView campaign = (DataRowView) e.Data.GetData(typeof(DataRowView)); // Get the old and new category ids int newID = (int)category[0]; int oldID = (int)campaign[1]; // Make sure the two do not match if (oldID != newID) { campaign.BeginEdit(); campaign[1] = newID; campaign.EndEdit(); } } } }
The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!