-
Dec 9th, 2019, 03:26 PM
#1
Thread Starter
Member
[RESOLVED] Replacing an existing form with an improved version
I have an existing, working application written in VB with just a couple of forms. One of the forms is rather complex (about 530 controls) and it's time to improve the usability of the form by changing the visual layout of the controls. With my limited experience with Visual Studio, I don't know the best way to accomplish this without destroying the original form. In a perfect world, here are some things I could do:
1. Simply clone the existing project and make all the changes in the new project, thus preserving the original. I see that many people over the years have asked about cloning a project in this way, but isn't easily done because of filenames and other considerations.
2. In the existing project, create a new form with all the modifications. Then rename the original form to some name indicating it's a backup and then renaming the new form using the name of the original form. What I don't know is: are there other linkages unknown to me that would prevent this approach from working.
Are there other ways to accomplish what I need to do? I've probably overlooked other simple solutions due to inexperience with lots of Visual Studio projects.
-
Dec 9th, 2019, 03:42 PM
#2
Re: Replacing an existing form with an improved version
You can create a Github repository for the Visual Studio solution. Once done create a new branch intended changes.
Master branch is the original, secondary branch is for moving forward.
https://help.github.com/en/github/co...our-repository
-
Dec 9th, 2019, 04:18 PM
#3
Thread Starter
Member
Re: Replacing an existing form with an improved version
Thanks for the suggestion. At this point, I know NOTHING about GIT Hub and would prefer a way to do this within Visual Studio.
-
Dec 9th, 2019, 04:35 PM
#4
Re: Replacing an existing form with an improved version
Your suggested option 1 is easy. You simply make a copy of the root folder, i.e. the folder containing the solution file. The SLN file contains the paths of project files but they are relative, so there's no issue. If people have trouble doing this it's because they did something silly.
That said, using source control would be the best way and offer other benefits too. You could always learn something about Github, like everyone else who uses it has.
-
Dec 9th, 2019, 04:40 PM
#5
Re: Replacing an existing form with an improved version
Your second option should work. At worst, make a backup of the project before you try that final step of renaming. Still, it should work as long as the publicly visible, and used, properties and methods match (if the property or method isn't used, it doesn't matter whether or not it matches). After all, a form is just a class. If you have Class Foo with some few methods, then create a Class Bar with the same few methods, that is much like a form class, except that it lacks that visible element (which is still just code found in the .designer.vb file for the form). Swapping one for the other can be done just as you described.
Of course, if there is a constructor for the form that takes arguments, then the new form must have the same constructor, or if some other object expects the form to have property P, then the new form must have property P. Fortunately, if you get something like that wrong, you'll know about it right away, as it will produce a compile time error, so you can rite what you didn't write right, right?
My usual boring signature: Nothing
-
Dec 9th, 2019, 07:19 PM
#6
Re: Replacing an existing form with an improved version
Originally Posted by Shaggy Hiker
Your second option should work. At worst, make a backup of the project before you try that final step of renaming. Still, it should work as long as the publicly visible, and used, properties and methods match (if the property or method isn't used, it doesn't matter whether or not it matches). After all, a form is just a class. If you have Class Foo with some few methods, then create a Class Bar with the same few methods, that is much like a form class, except that it lacks that visible element (which is still just code found in the .designer.vb file for the form). Swapping one for the other can be done just as you described.
Of course, if there is a constructor for the form that takes arguments, then the new form must have the same constructor, or if some other object expects the form to have property P, then the new form must have property P. Fortunately, if you get something like that wrong, you'll know about it right away, as it will produce a compile time error, so you can rite what you didn't write right, right?
Wright
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 10th, 2019, 08:23 AM
#7
Re: Replacing an existing form with an improved version
Originally Posted by Solo44
Thanks for the suggestion. At this point, I know NOTHING about GIT Hub and would prefer a way to do this within Visual Studio.
Those who use GitHub now when they started knew nothing either. Also, Visual Studio online is another option which works in Visual Studio too or even run Visual Studio from the cloud.
Here is a screenshot inside Visual Studio using GitHub.
On a side note, the image above can be found on the Visual Basic .NET landing page for Microsoft documentation which I'm a contributor.
https://docs.microsoft.com/en-us/dot...ZDO7EBGNjXjfu0
-
Dec 10th, 2019, 10:50 AM
#8
Thread Starter
Member
Re: Replacing an existing form with an improved version
OK - When I get some spare time, I'll dig into Git Hub. For now, here's the solution I arrived at:
1. Create a template of the existing application
2. Create a new application using that template (new name of course)
3. Create the new version of the main form for the new application
4. In Project - Properties - Application, change the startup form to the name of the new version of the main form.
Given that this is a hobby-related application, I'm satisfied with that approach. Thanks for all the input.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|