Правильная компиляция В Visual Studio 2008 - C#
Формулировка задачи:
здраствуйте у меня случилась такая проблема :
написал программу на .NET
роботает она лиж только у меня
если в настройках проекта в генерацию кода ставить многопоточный мт то при компиляции пишет ошибку
а если многопоточный мд то ошибок при компиляции нету но программа работает у 1ого из тысячи
подскажите как етот ньюанс исправить
Решение задачи: «Правильная компиляция В Visual Studio 2008»
textual
Листинг программы
#pragma once
namespace mailClient {
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 System::IO;
using namespace System::Net::Mail;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::TextBox^ textBox4;
private: System::Windows::Forms::TextBox^ textBox5;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::TextBox^ textBox6;
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->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->textBox5 = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->label5 = (gcnew System::Windows::Forms::Label());
this->textBox6 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(18, 9);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(79, 13);
this->label1->TabIndex = 0;
this->label1->Text = L"Логин@mail.ru";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(54, 32);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(43, 13);
this->label2->TabIndex = 1;
this->label2->Text = L"пароль";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(53, 61);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(44, 13);
this->label4->TabIndex = 3;
this->label4->Text = L"Кому@";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(103, 6);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(177, 20);
this->textBox1->TabIndex = 4;
this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(103, 29);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(177, 20);
this->textBox2->TabIndex = 5;
this->textBox2->TextChanged += gcnew System::EventHandler(this, &Form1::textBox2_TextChanged);
//
// textBox4
//
this->textBox4->Location = System::Drawing::Point(103, 58);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(177, 20);
this->textBox4->TabIndex = 7;
//
// textBox5
//
this->textBox5->Location = System::Drawing::Point(103, 84);
this->textBox5->Name = L"textBox5";
this->textBox5->Size = System::Drawing::Size(177, 20);
this->textBox5->TabIndex = 8;
//
// button1
//
this->button1->Location = System::Drawing::Point(103, 641);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 9;
this->button1->Text = L"отправить";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// label5
//
this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(65, 87);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(32, 13);
this->label5->TabIndex = 10;
this->label5->Text = L"тема";
//
// textBox6
//
this->textBox6->Location = System::Drawing::Point(15, 110);
this->textBox6->Multiline = true;
this->textBox6->Name = L"textBox6";
this->textBox6->Size = System::Drawing::Size(265, 525);
this->textBox6->TabIndex = 11;
this->textBox6->TextChanged += gcnew System::EventHandler(this, &Form1::textBox6_TextChanged);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 667);
this->Controls->Add(this->textBox6);
this->Controls->Add(this->label5);
this->Controls->Add(this->button1);
this->Controls->Add(this->textBox5);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label4);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e)
{
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
SmtpClient ^ client = gcnew SmtpClient("smtp.mail.ru");
SmtpClient ^ port = gcnew SmtpClient("25");
client->EnableSsl = true;
Net::NetworkCredential^ UsernamePassword = gcnew Net::NetworkCredential(textBox1->Text,textBox2->Text);
client->Credentials = UsernamePassword;
MailMessage ^MailMsg = gcnew MailMessage(textBox1->Text, "gancharuk1994@mail.ru", textBox5->Text, textBox6->Text);
client->EnableSsl = false;
client->Send(MailMsg);
MessageBox::Show("Ваше сообщение отправлено ...");
}
private: System::Void textBox3_TextChanged(System::Object^ sender, System::EventArgs^ e)
{
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox6_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
};
}