Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 05:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C++ WinForms Problem :S

Discussion on C++ WinForms Problem :S within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
uebertreiber's Avatar
 
elite*gold: 0
Join Date: Mar 2012
Posts: 298
Received Thanks: 28
C++ WinForms Problem :S

Guten Tag, habe eine Fehlermeldung die ich leider nicht nachvollziehen kann könnte mir vllt ejmand helfen ?

Fehlermeldung in Visual Studio 2012:
1>------ Build started: Project: Calculator, Configuration: Debug Win32 ------
1> MyForm.cpp
1>c:\users\lulzsec\desktop\calculator\calculator\M yForm.h(191): warning C4244: '=' : conversion from 'wchar_t' to 'char', possible loss of data
1>LINK : fatal error LNK1561: entry point must be defined
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


danke
Code:
#pragma once

namespace Calculator {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace std;

	/// <summary>
	/// Summary for MyForm
	/// </summary>
	public ref class MyForm : public System::Windows::Forms::Form
	{
	public:
		MyForm(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~MyForm()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TextBox^  textBox1;
	protected: 
	private: System::Windows::Forms::TextBox^  textBox2;
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::Button^  button2;
	private: System::Windows::Forms::Button^  button3;
	private: System::Windows::Forms::Button^  button4;
	private: System::Windows::Forms::Button^  button5;
	private: System::Windows::Forms::Label^  label2;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->textBox2 = (gcnew System::Windows::Forms::TextBox());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->button3 = (gcnew System::Windows::Forms::Button());
			this->button4 = (gcnew System::Windows::Forms::Button());
			this->button5 = (gcnew System::Windows::Forms::Button());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->SuspendLayout();
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(82, 84);
			this->textBox1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System::Drawing::Size(234, 30);
			this->textBox1->TabIndex = 0;
			// 
			// textBox2
			// 
			this->textBox2->Location = System::Drawing::Point(82, 198);
			this->textBox2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->textBox2->Name = L"textBox2";
			this->textBox2->Size = System::Drawing::Size(234, 30);
			this->textBox2->TabIndex = 1;
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(166, 139);
			this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(64, 25);
			this->label1->TabIndex = 2;
			this->label1->Text = L"label1";
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(489, 81);
			this->button1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(140, 41);
			this->button1->TabIndex = 3;
			this->button1->Text = L"+";
			this->button1->UseVisualStyleBackColor = true;
			this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(489, 139);
			this->button2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(140, 50);
			this->button2->TabIndex = 4;
			this->button2->Text = L"-";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &MyForm::button2_Click);
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(489, 198);
			this->button3->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->button3->Name = L"button3";
			this->button3->Size = System::Drawing::Size(140, 48);
			this->button3->TabIndex = 5;
			this->button3->Text = L"*";
			this->button3->UseVisualStyleBackColor = true;
			this->button3->Click += gcnew System::EventHandler(this, &MyForm::button3_Click);
			// 
			// button4
			// 
			this->button4->Location = System::Drawing::Point(489, 256);
			this->button4->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->button4->Name = L"button4";
			this->button4->Size = System::Drawing::Size(140, 47);
			this->button4->TabIndex = 6;
			this->button4->Text = L"/";
			this->button4->UseVisualStyleBackColor = true;
			this->button4->Click += gcnew System::EventHandler(this, &MyForm::button4_Click);
			// 
			// button5
			// 
			this->button5->Location = System::Drawing::Point(142, 256);
			this->button5->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->button5->Name = L"button5";
			this->button5->Size = System::Drawing::Size(112, 36);
			this->button5->TabIndex = 7;
			this->button5->Text = L"=";
			this->button5->UseVisualStyleBackColor = true;
			this->button5->Click += gcnew System::EventHandler(this, &MyForm::button5_Click);
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->Location = System::Drawing::Point(166, 305);
			this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(64, 25);
			this->label2->TabIndex = 8;
			this->label2->Text = L"label2";
			// 
			// MyForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(12, 25);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(801, 403);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->button5);
			this->Controls->Add(this->button4);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->textBox1);
			this->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
			this->Name = L"MyForm";
			this->Text = L"Calculator";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 label1->Text = "+";
			 }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
			 label1->Text = "-";
		 }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
			 label1->Text = "*";
		 }
private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
			 label1->Text = "/";
		 }
private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
			 char sw; 
			 double a, b, erg;
			 sw = System::Convert::ToChar(label1->Text);
			 a =  System::Convert::ToDouble(textBox1->Text);
			 b =  System::Convert::ToDouble(textBox2->Text);

			 switch(sw)
			 {
				case '+':
					erg = a + b;
					break;

				case '-':
					erg = a - b;
					break;
		
				case '*':
					erg = a * b;
					break;

				case '/':
					erg = a / b;
					break;

			 }
			 label2->Text = System::Convert::ToString(erg);
		 }
};
}
Fehler müsste in diesem Abschnitt sein :S
Code:
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 label1->Text = "+";
			 }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
			 label1->Text = "-";
		 }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
			 label1->Text = "*";
		 }
private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {
			 label1->Text = "/";
		 }
private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
			 char sw; 
			 double a, b, erg;
			 sw = System::Convert::ToChar(label1->Text);
			 a =  System::Convert::ToDouble(textBox1->Text);
			 b =  System::Convert::ToDouble(textBox2->Text);

			 switch(sw)
			 {
				case '+':
					erg = a + b;
					break;

				case '-':
					erg = a - b;
					break;
		
				case '*':
					erg = a * b;
					break;

				case '/':
					erg = a / b;
					break;

			 }
			 label2->Text = System::Convert::ToString(erg);
		 }
};
}
uebertreiber is offline  
Old 07/27/2013, 14:19   #2


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,905
Received Thanks: 25,407
Arrow C/C++ -> .NET Languages

#moved
Das ist C++/CLI
MrSm!th is offline  
Old 07/27/2013, 14:55   #3
 
elite*gold: 10
Join Date: Aug 2012
Posts: 813
Received Thanks: 106
Ich frage mich, warum es so viele nicht kapieren, dass sie es in die Sektion, welche extra für C++ ist, posten sollen... Die C++ Sektion ist sogar direkt über der für .NET.
GodHacker is offline  
Old 07/27/2013, 15:00   #4
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Quote:
Originally Posted by GodHacker View Post
Ich frage mich, warum es so viele nicht kapieren, dass sie es in die Sektion, welche extra für C++ ist, posten sollen... Die C++ Sektion ist sogar direkt über der für .NET.
...Kein Kommentar


Der Fehler steht doch eh schon dort:
"entry point must be defined"
.SkyneT. is offline  
Old 07/27/2013, 15:01   #5
 
Schlüsselbein's Avatar
 
elite*gold: 0
Join Date: Feb 2013
Posts: 1,137
Received Thanks: 869
Quote:
Ich frage mich, warum es so viele nicht kapieren, dass sie es in die Sektion, welche extra für C++ ist, posten sollen... Die C++ Sektion ist sogar direkt über der für .NET.
Autsch.

@TS: C# oder C++ benutzen, kein C++/CLI.
Schlüsselbein is offline  
Old 07/27/2013, 15:14   #6


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,905
Received Thanks: 25,407
Quote:
Originally Posted by GodHacker View Post
Ich frage mich, warum es so viele nicht kapieren, dass sie es in die Sektion, welche extra für C++ ist, posten sollen... Die C++ Sektion ist sogar direkt über der für .NET.
Danke, dass du mir verrätst, welche Sektionen mein Bereich hat. War mir gar nicht bekannt.
MrSm!th is offline  
Thanks
4 Users
Reply


Similar Threads Similar Threads
[C# WinForms] Picturebox.Height aus Textbox auslesen & ersetzen
03/09/2013 - General Coding - 0 Replies
Hey! C# / WinForms Ich verzweifle gerade, denn ich habe keine Ahnung, wie ich aus einer Textbox den Wert an die Höhe/Breite einer PictureBox anlegen kann... :/ Also ich habe eine PictureBox und deren Höhe soll per Button von einer Textbox ausgelesen werden und halt ersetzt werden...
C++ Code ConsoleApp -> WinForms
01/08/2013 - C/C++ - 1 Replies
Hey, i want to implement some code from my console app to my win form. dont know how to write that for loop in win forms though... pls help, thanks. in console app:
C++ (WinForms) Play .wav file from resource
12/05/2012 - C/C++ - 2 Replies
Hey, im trying to play a .wav sound from my resources in c++. works with PlaySound() in console app. but i cant figure out how to play the sound in winformsapp. tryed a few things out but it wont work. google didnt help me that much...
C# WinForms edit controls from another class.
10/18/2012 - .NET Languages - 5 Replies
Please help me i can't use txtBox from the other classes.
[Problem]Habe ein Problem und zwar spinnt mein VPC etwas(ohne Grund)?!
07/28/2011 - Metin2 Private Server - 10 Replies
Also wie schon gesagt meins Server spinnt wodurch kiks usw. kommen :( ich lade euch die Screens in den Anhang, mit der Hoffnung, dass ihr mir helfen könnt :) wäre echt sehr nice :)



All times are GMT +1. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.