Adding same second Form2 to same project but same style as template vb net - vb.net

I have made some borderless Form1 in my solution, now I want AboutBox will have same design and also I need more 2,3 Forms but same style.
If I click "add new item" or "existing" it add the main Form like default Visual Basic has :'(
How should I proceed?

In fact, all the design of the form is stored in the Form.Designer.vb! file.
You can simply copy the properties you wish to apply to the added forms and past it in their designer accordingly.
Check image below to see the designer.
Modify the form as you wish them to be.
Once done, save the changes
Open the designer and copy all the codes
Add another form.
Open its designer and paste all codes
Change the name of the form
The form will be a duplicate of the previous one and you can adapt your changes.

Related

add new form to desktop app VB.NET VS 2019

This is my first application using VB.NET.
I am trying to add new windows form to my application. I followed the tutorials too but can't add the new form .
I am trying to add new form by right clicking in my project -> add -> Form (Windows Form). But this form does not show designer.vb code. I do not know what am I doing wrong. I just want to create a new windows form like the default form created in the project. The default form created in the project has designer.vb and resx file.
When I try to add new form via Project menu, I can't find any of the icons that resemble to the icon of the default form Form1.vb.
Please see the attached image for details.
You can do this two ways:
Add->new->new item. You see this:
Then you get this:
So, from above, you select Form (windows form)
but, since creating a new form is "common"
Then you can use what you choose:
right click, add->Forms (windows form)
that will then launch the SAME screen as above, but WITH the forms already selected - hardly saves you much effort and time - but either way, you can then type in the form name - BUT BE CAREFULL!!! - WHAT you type in, if you change the extension, you will wind up creating somthing VERY differnt.
So, ONLY edit the name part, so when I do above, and choose forms (windows form), then I get this:
But ONLY edit the text "form1" and do NOT change, or mess with the .vb that follows.
So, I can chose (set) the form name to MyCoolForm like this
So, don't put spaces in the name, and LEAVE alone the .vb part. That is also imporant.
Now, hit add,
and you should see this:

How to add an existing form to an existing VB Project

I am trying to add an existing form to a VB project(Ctrl-D) when I locate and copy the 3 files into the project the designer.vb form name appears with a small "VB" logo attached and the form is blank but has the correct filename/form name.
The code behind the form is correct and intact.

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.

main.vb, main.designer.vb and missing Form Designer

I have been working with "visual basic.net" on a "windows forms" application. While manipulating controls and adding event handlers I noticed the resultant code was being generated within a file named 'main.designer.vb'. However, if I look in the solution explorer for my project there is no 'main.designer.vb' file, just 'main.vb'.
This is not a colossal problem as it runs properly. However, having closed the 'form designer' window I now cannot reopen it! 'main.vb' has no option to 'view in form designer'.
Any advice on this?
Would it be possible to copy the contents of 'main.designer.vb' in to 'main.vb' and delete 'main.designer.vb' entirely? If I did this, the next time I manipulated the form would the code be added to 'main.vb' or would a new 'main.designer.vb' be created?
I seem to have sorted out the problem.
'main.vb' was completely empty. All the code I had generated and written directly was inside 'main.designer.vb'. However, once I made a class definition within 'main.vb':
Public Class main
End Class
and then cut/pasted all my custom event handler code and subroutines from 'main.designer.vb' to THAT class - all was well. 'main.vb' now shows the correct form icon and FINALLY offers the correct 'view designer' context menu option.
I am not sure why it happened in the first place though.
Look in the Solution Explorer in Visual Studio. In the toolbar in this window is a button called "Show all files". Click it.
Then every file in the projects folder is actually shown in the solution explorer. Expand the treenodes for the form and you will see the designer.vb.
There are also buttons for switching between code-view and designer view. Just remember to select the form in the solution explorer for the buttons to show the correct form in the designer.

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).