Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I drag and drop TabPages between TabControls?

drag drop tabpages
0
Posted

How can I drag and drop TabPages between TabControls?

0

The following code snippet shows how you can drag a TabPage from TabControl1 and drop it into TabControl2 (whose AllowDrop property must be set to True): $$ [C#] Source TabControl private void tabControl1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.tabControl1.DoDragDrop(this.tabControl1.SelectedTab,DragDropEffects.All); } } //Target TabControl private void tabControl2_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { if(e.Data.GetDataPresent(typeof(TabPage))) { e.Effect = DragDropEffects.Move; } else e.Effect = DragDropEffects.None; } private void tabControl2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { TabPage DropTab = (TabPage)(e.Data.GetData (typeof(TabPage))); this.tabControl2.TabPages.Add (DropTab); } [VB.NET] ‘Source TabControl Private Sub tabControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) If e.Button = MouseButtons.Left Then Me.tabControl

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123