Menustrip Style Custom Designer in VB .NET - vb.net

I am trying to create a user control and custom designer. The perfect example of what I am trying to achieve in design time is how the menuStrip allows you to enter the text of the item being added.
This tells me it is possible, but I do not know if they are just drawing a box/cursor and just handling the key events individually or if they are using a textBox control in the designer somehow.
Is there a way to use controls in the designer during design time?

Related

Display controls in Designer VB.Net 2013

I have a set of controls which are added dynamically to a panel. The number of controls depends on which tab a user selects from TabPage control, which is embedded in a form.
At the moment, the controls don't appear in Designer, but appear during execution.
I managed to display controls for other forms which are not dynamic by moving the non-design code to the vb file, but how can I display the other ones?
The only answer that I know of is to add your code in the .Designer.vb file of the Form.
BUT! I strongly advise you to avoid that if you are not sure how it works! Custom code in the .Designer. files can break your form design and project with possible random crashes.
Also, your code can be changed and removed by the Visual Studio designer:
Custom code in designer.vb file goes away when making edits in design mode
Instead, you can make the panels into custom user controls and add those to the tabs.

Code behind does not get called on dynamically created user controls

I am writing a WPF VMMV application.
- I am dynamically loading XAML into the window that contains user control.
- The user control has a textbox besides other simple controls
- The textbox has MouseDoubleClick and KeyDown events
Now, when I load a XAML which has my User Control, the control can be seen (as in the XAML designer), but the events won't work.
I have tried to make the user control with the MVVM pattern instead with code behind. That also does not work. Any experience with this or suggestions?

Edit form in desginer that is generated at load time

Hi
Just inherited a VB forms application that must be modified. My problem is that the controls are placed at the form at the load event. There is no controls on the form when I open the form1.vb in Solution explorer.
How can I achieve changing the design for the form?
/Andy.l
You'll have to locate the code that creates and adds controls (I guess you found it in the Load event) and modify that code. Or else comment that code out and add all the same controls in the designer.
If the controls are not dynamic (i.e. if the Load event always adds the same controls in the same positions), then your best long-term solution is my second suggestion (add all the controls "properly" in the designer).

Clone Winform control

I have a groupox in a VB.NET winform app. The groupbox contains a few Labels, Textboxes and Checkboxes. This was created by simply dragging the controls out of VS toolbox.
What I need to do is take the 1 Groupbox and at runtime create multiple Groupboxes to display based on user selection. Instead of dynamically creating the Groupboxes and other controls nested inside, is there a way to clone or copy the original one.
Then I'd just change the properties. Label text, Textbox text, etc. And the location of the Groupbox in the layout.
What you could do is create a user control based upon your groupbox which would allow its reuse. You could then create the instances you require at runtime and add them to the form.
Maybe suggest that you look into creating user controls for winforms.
Could this be a help to you?
How to Clone/Serialize/Copy & Paste a Windows Forms Control

VB .NET Save Panel without form

In Visual Studio 2008, using VB .NET, I have a Split Container that I want to dynamically load panels into the Panel2 slot from other team member's work based on user input in the Panel1 controls.
Can my team members work on panels outside of a form, save it, then have the main Form just load those panels when needed without copying and pasting each panel into the form and making them visible and invisible?
Thanks.
Sure, have the team build user controls which you will then add to the control collection for the panel.