![]() |
|
[.NET] VB.NET Help - Send Back Control To Main Form - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] VB.NET Help - Send Back Control To Main Form (/showthread.php?tid=5072983) |
VB.NET Help - Send Back Control To Main Form - Diamondo - Nov 27, 2015 I'm using this code to bring one control from form1 to form2: Code Me.Controls.Add(Form1.TabControl1)Everything is fine. But the problem is that the tabcontrol permanently disappeared from form1 and I can't send back the tabcontrol. Something like this will work: Code Form1.Controls.Add(Me.TabControl1)But the problem is that the TabControl1 don't exist in form2 until I send it to it. I don't ask to use the same tabcontrol at the same time on two different times. I just want to send it back to it's original form. I know that is a variable that keeps track of that tabcontrol. It is form1.tabcontrol, even if it is actually moved to form2 and I tried this code: (But it also doesn't worked...) Code Form1.Controls.Add(Form1.TabControl1)Please help me! :( * - Tedd - Nov 27, 2015 Just mirror the control on your second form and add a handler.. EG: Form1.vb (One button) Code Public Class Form1Form2.vb (One button) Code Public Class Form2* - Diamondo - Nov 27, 2015 (Nov 27, 2015 11:39 AM)Tedd Wrote: Just mirror the control on your second form and add a handler.. This is not a bad idea. Thank you! Also I found myself another better way to do it: Code Dim Formx As New Form1I jost got everything from there and it worked like a charm. 🤝 |