Correcting Visual Studio 2022 Windows Form renaming problem - visual-studio

I saved out a VB Windows Form as a Template. Upon "Add New Item" and Deleting the original "Form1" I get a Me.MainForm = Form1 error. I have exported/ Imported several other Forms this way and simply renamed all the associated tags without a problem. Now I'm getting "Error BC30109 'CharacterSheet' is a class type and cannot be used as an expression."
I used the same "Find and Replace" as the previous times.
When you "Project, Add New Item" VB Places a number at the end of the Object Name. e.g. CharacterSheet1. I simply renamed the object w/o the 1.
Created a new VB Windows Form.
Project, Add New Item, Select the Desired Template.
Renamed the imported Object "CharacterSheet1" in the Object Properties window to "CharacterSheet".
Renamed the Imported Object "CharacterSheet1" in the Solution Explorer window to "CharacterSheet".
Deleted the original Form1.
Now we are here...
Severity Code Description Project File Line Suppression State Error BC30109 'CharacterSheet' is a class type and cannot be used as an expression. CharacterSheet C:\Users\drago\OneDrive\Desktop\WorldOfForms\CharacterSheet\My Project\Application.Designer.vb 36 Active

Related

Xamarin System.Exception when adding Content page VS

When trying to add a Content Page to the solution in visual studio, the following error occurs:
Exception of type 'System.Exception' was thrown.
The project system has encountered an error.
Did not find new element in the hierarchy for item `Views\MyPage.xaml`.
The item would have been added with type "Page".
The project item schema service knows about this item type.
The item does exist in the project file.
When adding the file I do the following:
Right click on Views in my Xamarin Solution > Add > New Item > Content Page > Add
When looking in the windows explorer, there is a file created MyPage.xaml but it has not created MyPage.xaml.cs and it is not added to the solution
It is a blank Xamarin shared project and this error just keeps happening...
It's driving me nuts as I can't even add a single page
As a workaround, I add the files manually using the W. explorer and then edit app.projitems manually, but this is just ridiculous.
As a dirty workaround until this gets fixed, adding the files "manually" to the project gets the job done.
With Visual Studio closed,
copy/paste existing (working) *.xaml and *.xaml.cs files (rename
them as you please)
open the newly pasted files with a text
editor (not VS) and rename the contents to your chosen name in #1
add newly pasted files to your *.projitems file (open it in a text
editor, search for the filenames you copied in #1 and add the new
ones similarly) - there'll be 3 places to add them
Now open the solution in VS and rebuild - it should look and build fine.
Apparently, if you go into the VS2017 installer and install the Universal Windows Platform (UWP) development workload, this fixes the issue.
Make sure you have
StackLayout
instead of
ContentPage.Content
in your .xaml files that throw this exception on VS.

How do I "clone" a VB6 form [duplicate]

This question already has answers here:
How to add a form that is existing to a vb6 project?
(3 answers)
Closed 8 years ago.
I have opened a form, then clicked File-Save Form As, and given it a new name. But this just renames the existing form. I want to keep the existing form, but also have a copy with a different name.
VB6 does keep the original form -- on disk -- it just doesn't keep it in the project, so this should do it:
If you've made changes to the open file, you may want to save it in its current place, as this won't happen automatically when you save as.
Save the form as its new file name.
Also change the name of the form in the Properties window to match the new file name.
Do Project -> Add Form -> Existing and re-add the original file.
Well, I haven't had a running VB6 environment for almost a decade, but I think that all you have to do is to make a copy (from Windows Explorer or DOS command line) of your form's .FRM and .FRX files, save them with your new intended form name (the .FRM and .FRX must have the same name), and then use "Add Existing Form" in your Project menu to add it to your project.

Visual Studio Converted Project User Control Designer File Incorrect

I have an ASP.Net project that I converted to C# from VB using InstantC#. The conversion appears to have happened pretty well. Only a few items had to be fixed manually. I did this after converting the project from VS2010 to VS2012. Once I fixed the inferred method and object references, I was able to build once.
Upon viewing the page, I received an Object Null Reference Exception on an event handler assignment.
I built again. This time, I received all kinds of errors from the methods and properties for code that referred to other user controls that the page has on it. In looking at the designer file, it is not correctly determining and assigning the types to the controls.
I have tried manually changing the object types, but Visual Studio changes them back.
I have also tried deleting the designer file and choosing Convert to Web Application.
There are other user controls in the same project that work fine. No issues. Any other ideas on how to fix this?
I finally fixed this by creating a brand new user control, and then pasting the UI from the original user control. Once I confirmed the designer file was generated correctly, I imported the code behind from the original user control.
To be sure everything went as planned, I renamed and excluded the original user control from the project and tested the new one. When I confirmed that things were working, I deleted the original.

Creating a Visual Studio 2010 Item Template with multiple folders and files

I've been reading info on this the past few days and though I've made some progress, I'm still a bit lost.
I have created a collection of classes, files, and folders that together I want to join together as a Visual Studio Item Template.
Think of it as a "module".
The idea is that they add this "Module Item Template" and Visual Studio will insert the folders and files and rename them accordingly.
This is not a PROJECT template it is an ITEM TEMPLATE, because it needs to be added to an already existing project they are working on, within that project (not as a separate one).
By using the Visual Studio 2010 SP1 SDK Item Template Template, I've ALMOST got it.
The problem is that when I use the $safeitemname$ I get different names in each class.
I was hoping that when they add the item, and name it say "MyModule", the value $safeitemname$ would be "MyModule".
this isn't happening. Instead, each generated class file gets a different value for $safeitemname$ that matches the generated file name.
So for example if I have a MyModuleConfig.cs class, and I have another class file setup like this:
public class $safeitemname$Config
{
}
instead of getting the Item name that the user entered "MyModule" together with config, the class gets named "MyModuleConfigConfig".
How can I tell it to only use the original name that the user entered when they created the module in the Add Item dialog using the template?
okay literally seconds after posting this I discovered that I should be using the $fileinputname$ instead!
this appears to be exactly what I wanted, thanks, self!

conflicting Dlls

Iam getting following error when iam using 'System.Net.HttpStatusCode' in my wcf project.
The type 'System.Net.HttpStatusCode' exists in both 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll' and 'D:\HKMP\Branch\NewAmelio\amelioSL\Web\Services\bin\System.Net.dll'
HttpResponseMessageProperty property = new HttpResponseMessageProperty();
// Here the response code is changed to 200.
property.StatusCode = System.Net.HttpStatusCode.OK;
In your Visual Studio project do you have the reference to System.Net.dll marked as "Copy Local"? Select the reference in Solution Explorer and then press F4 to open the property grid. You'll want to make sure that Copy Local is set to "false" because this reference is already available on every computer with the .NET Framework installed.
You'll then also want to delete any copy of System.Net.dll that you have in your project folder as well as delete it from source control.

Resources