Cannot add an object to Windows Forms .VB

Cannot add an object to Windows Forms .VB

Hubert_Los
Advocate Advocate
573 Views
5 Replies
Message 1 of 6

Cannot add an object to Windows Forms .VB

Hubert_Los
Advocate
Advocate

Hello,

I have created a program in visual studio. The program creates a button on the ribbon that calls the program. Now I would like to create a simple API, but I can't add any object to the form in VS. An error appears:

"Object reference not set to an instance of an object."

 

Program based on template from SDK/Developertools.

Can I create an API based on it?



Hubert_Los_1-1713359318697.png

 

0 Likes
Accepted solutions (1)
574 Views
5 Replies
Replies (5)
Message 2 of 6

Frederick_Law
Mentor
Mentor

Create API?  Application Programming Interface?

You're using API to make addin.

 

Form are UI, User Interface.

 

Looks like something wrong with your Visual Studio.

How are you adding object to Form?  By VB program?

0 Likes
Message 3 of 6

Hubert_Los
Advocate
Advocate

Yes, you are right, I mean UI.

I created a new project from the template, set net.freamwork

Hubert_Los_0-1713416981936.png
add Form

Hubert_Los_1-1713417000586.png

I drag elements from the toolbox into the form.

Hubert_Los_2-1713417112085.png

error appears.

This problem does not appear if I select a new project "Windows Form App(.Net Freamwork)"

 

 

0 Likes
Message 4 of 6

Michael.Navara
Advisor
Advisor

It looks like an issue in VisulaStudio or project (corrupted project or item templates?). You can try to create new project based on template ClassLibrary (.Net Freamwork) and create form with controls. If it works, the issue is in the project.

0 Likes
Message 5 of 6

Hubert_Los
Advocate
Advocate

My template was in "developertools.msi". Oddly, it is not correct.

"You can try to create a new project based on the ClassLibrary (.Net Freamwork) template and create a form with controls."
It works.

I will try reinstalling Visual Studio

Maybe someone could provide me with the template. It can also be in c#, because I also have a problem with the template working correctly in c#.
The same simple code works in VB but in c# unfortunately not.

0 Likes
Message 6 of 6

Hubert_Los
Advocate
Advocate
Accepted solution

I used template from Inventor 2025. Now it works

0 Likes