Hi, I am getting this error when I run my program. When I add more characters to my text box it crashes when I run the program. If I have less characters in the text box it runs fine. Same thing happens with other controls that contain text.

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.

Seems like a memory error? If so what can I do?

Sorry for another question...
Please give more information and/or show some source code!

Is this really a pure C++/Win32 question? Are you using some sort of GUI framework?

"System.Resources.MissingManifestResourceException" sounds more like .NET to me:
Last edited on
It reminds me a buffer overflow or stack overflow. Check allocation memory for strings ++
Yeah that’s probably it. I have over 100 labels on the form. I am able to add more code to the source code without a problem. Just not text in the designer/control.

I am using c++ cli visual studio. I have way too much code to be able to show and wouldn’t know where to start
Last edited on
Again, which framework/toolkit do you use to create the GUI? Be aware that C++ itself does not provide any GUI features, but there are many GUI toolkits/frameworks written in C++ (Qt, wxWidgets, etc. pp.)

But from your error message, it would seem like you are using Microsoft.NET, not C++.

Anyways, just a wild guess: If you have such a huge number of labels, it's probably not a good idea to create them all in the GUI designer. Instead, try creating them dynamically, in the program code. Like this:

for (int i = 0; i  < 100; ++i)
    layout.addWidget(new Label(/*...*/));

(Of course, the details depend on which GUI framework/toolkit you are using!)
Last edited on
Thanks for your reply.

I am using Visual studio 2019 with a c++ cli project. I’m assuming that is using.net.
Using the designer. I added a help button that shows a message box. That seems to work.
Still no luck on the text box control though. Using Window 10 os
Neither C++ in genereal nor CLI (command-line interface) has anything to do with GUI or .NET 😕

So it's still not clear what technology your are using...
Last edited on

I am using "Microsoft.NET SDK 5.0.101 (x64) from Visual Studio"
That's what it says in control panel/Programs.

As for GUI... I'm using windows forms. Windows 10. Not sure what else you mean.
Last edited on
cli in this context means Common Language Infrastructure

It's MS attempt to shoehorn .net into C++ - with a 'new' language c++/cli
cli in this context means Common Language Infrastructure

I see.

As for GUI... I'm using windows forms.

So, you are using Microsoft.NET with the Windows Forms GUI toolkit. That is the relevant information.

Still my suggestion, if you need a huge number of labels, then it's probably better to create those labels at run-time, by using a loop, instead of creating them at design-time one-by-one.

See chapter "2. Run-Time" here:

The example code shows how to programmatically create label. They only create one label, yes, but you get the idea. I think you should be able to easily create a loop around that code!
Last edited on
Shouldn't this work? I had to convert the sample from C# to C++. I now get this error

System.NullReferenceException: Object reference not set to an instance of an object

private: System::Void Music_Load(System::Object^ sender, System::EventArgs^ e)
		// Creating and setting the label
		Label^ mylab1;
		mylab1->AutoSize = true;
		mylab1->BackColor = System::Drawing::Color::White;
		mylab1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 24, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
		mylab1->ForeColor = System::Drawing::Color::Blue;
		mylab1->Location = System::Drawing::Point(376, 1287);
		mylab1->Name = L"label14";
		mylab1->Size = System::Drawing::Size(125, 37);
		mylab1->Text = "Sample Text";

I found this link.

I got it working. Had to create the control further up in the code adding the line instead. like this...

private: System::Windows::Forms::Label^ mylab1;

Not sure why. Something to do with Scope? or wrong namespaces?
Last edited on
Is there a "mylab1 =" anywhere in your code? (space between 1 and = optional)
Last edited on
yes there is...
this->mylab1 = (gcnew System::Windows::Forms::Label());
This problem is solved.program no longer crashes if I create the control with text at runtime like you suggested.
Thanks a lot.
Just to follow-up on my question and your answer. The difference is that
private: System::Windows::Forms::Label^ mylab1; exists in the scope of your class, and is initialized properly (your second to last post).

The Label^ mylab1; you create in Music_Load is only a local variable, and is never initialized.

Topic archived. No new replies allowed.