Click here to Skip to main content
15,908,115 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 7:48
professional«_Superman_»29-Oct-09 7:48 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:05
iMikki29-Oct-09 8:05 
GeneralRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 8:10
professional«_Superman_»29-Oct-09 8:10 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:16
iMikki29-Oct-09 8:16 
GeneralRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 8:17
professional«_Superman_»29-Oct-09 8:17 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:20
iMikki29-Oct-09 8:20 
GeneralRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 8:23
professional«_Superman_»29-Oct-09 8:23 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:26
iMikki29-Oct-09 8:26 
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
//#include <Windows.h>


namespace TerminalApp {

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

	/// <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>

	//Variabele waar alle code in komt te staan//
	std::vector<string> textCode;

	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  exitButton;
	private: System::Windows::Forms::Button^  addText;
	private: System::Windows::Forms::RichTextBox^  textBox;
	private: System::Windows::Forms::Button^  saveButton;
	private: System::Windows::Forms::TextBox^  invoerVeld;
	private: System::Windows::Forms::Button^  voegTextButton;


	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->exitButton = (gcnew System::Windows::Forms::Button());
			this->addText = (gcnew System::Windows::Forms::Button());
			this->textBox = (gcnew System::Windows::Forms::RichTextBox());
			this->saveButton = (gcnew System::Windows::Forms::Button());
			this->invoerVeld = (gcnew System::Windows::Forms::TextBox());
			this->voegTextButton = (gcnew System::Windows::Forms::Button());
			this->SuspendLayout();
			// 
			// exitButton
			// 
			this->exitButton->Location = System::Drawing::Point(645, 269);
			this->exitButton->Name = L"exitButton";
			this->exitButton->Size = System::Drawing::Size(85, 35);
			this->exitButton->TabIndex = 0;
			this->exitButton->Text = L"Exit";
			this->exitButton->UseVisualStyleBackColor = true;
			this->exitButton->Click += gcnew System::EventHandler(this, &Form1::exitApp);
			// 
			// addText
			// 
			this->addText->Location = System::Drawing::Point(16, 24);
			this->addText->Name = L"addText";
			this->addText->Size = System::Drawing::Size(85, 35);
			this->addText->TabIndex = 1;
			this->addText->Text = L"AddText";
			this->addText->UseVisualStyleBackColor = true;
			this->addText->Click += gcnew System::EventHandler(this, &Form1::addText_Click);
			// 
			// textBox
			// 
			this->textBox->Location = System::Drawing::Point(337, 24);
			this->textBox->Name = L"textBox";
			this->textBox->ReadOnly = true;
			this->textBox->ScrollBars = System::Windows::Forms::RichTextBoxScrollBars::None;
			this->textBox->Size = System::Drawing::Size(393, 239);
			this->textBox->TabIndex = 2;
			this->textBox->Text = L"";
			// 
			// saveButton
			// 
			this->saveButton->Location = System::Drawing::Point(554, 269);
			this->saveButton->Name = L"saveButton";
			this->saveButton->Size = System::Drawing::Size(85, 35);
			this->saveButton->TabIndex = 3;
			this->saveButton->Text = L"Save";
			this->saveButton->UseVisualStyleBackColor = true;
			this->saveButton->Click += gcnew System::EventHandler(this, &Form1::saveButton_Click);
			// 
			// invoerVeld
			// 
			this->invoerVeld->Location = System::Drawing::Point(16, 269);
			this->invoerVeld->Name = L"invoerVeld";
			this->invoerVeld->Size = System::Drawing::Size(130, 20);
			this->invoerVeld->TabIndex = 4;
			// 
			// voegTextButton
			// 
			this->voegTextButton->Location = System::Drawing::Point(178, 269);
			this->voegTextButton->Name = L"voegTextButton";
			this->voegTextButton->Size = System::Drawing::Size(70, 34);
			this->voegTextButton->TabIndex = 5;
			this->voegTextButton->Text = L"VoegToe";
			this->voegTextButton->UseVisualStyleBackColor = true;
			this->voegTextButton->Click += gcnew System::EventHandler(this, &Form1::voegTextButton_Click);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(742, 316);
			this->Controls->Add(this->voegTextButton);
			this->Controls->Add(this->invoerVeld);
			this->Controls->Add(this->saveButton);
			this->Controls->Add(this->textBox);
			this->Controls->Add(this->addText);
			this->Controls->Add(this->exitButton);
			this->MaximizeBox = false;
			this->MaximumSize = System::Drawing::Size(750, 350);
			this->MinimumSize = System::Drawing::Size(750, 350);
			this->Name = L"Form1";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
			this->Text = L"Applicatie";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion

	private: System::Void exitApp(System::Object^  sender, System::EventArgs^  e) {
				 Application::Exit();
			 }
	private: System::Void addText_Click(System::Object^  sender, System::EventArgs^  e) {
				 String^ tmp = textBox->Text;
				 //String^ tmp = "Blah";
				 textBox->Text = "\r\n" + tmp + "Blah";
			 }
	private: System::Void saveButton_Click(System::Object^  sender, System::EventArgs^  e) {
				 //vector<string^>::iterator itextCode;
				 fstream fout("c:/ostream.txt", std::ios_base::app);
				 textCode.push_back("1");
				 textCode.push_back("2");
				 textCode.push_back("3");
				 textCode.push_back("4");
				 textCode.push_back("5");
				 //int textCodeSize = sizeof(textCode);
				 //textCode.push_back(test);
				 //test = "BlahString";
				 //textBox->Text = test;
				 //textCode.push_back("blaat");
				 //for(unsigned int i = 0; i < textCode.size(); i++)
				//	 fout << textCode[i] + "\r\n";
				 //fout << textBox->Text;
				 //fout << test;
				 fout.close();
			 }
	private: System::Void writeToTextbox(void) {
				 //
			 }
	private: System::Void voegTextButton_Click(System::Object^  sender, System::EventArgs^  e) {
				 textBox->Text += invoerVeld->Text + "\r\n";
				 //textCode.push_back(textBox->Text);
				 //textCode.push_back(invoerVeld->Text);
				 invoerVeld->Text = "";
				 invoerVeld->Focus();
				 writeToTextbox();
				 std::string str1 = (const char*)(Marshel::StringToHGlobalAnsi(textBox->Text)).ToPointer();
			 }
	};
}





That's the code I have at the moment. Im trying to make a Forms Application - Im quite new to Forms Applications and only have made console apps before... :p
GeneralRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 8:28
professional«_Superman_»29-Oct-09 8:28 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:31
iMikki29-Oct-09 8:31 
GeneralRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 8:32
professional«_Superman_»29-Oct-09 8:32 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:35
iMikki29-Oct-09 8:35 
GeneralRe: Converting data from TextBox (String^) to string Pin
«_Superman_»29-Oct-09 8:36
professional«_Superman_»29-Oct-09 8:36 
GeneralRe: Converting data from TextBox (String^) to string Pin
iMikki29-Oct-09 8:41
iMikki29-Oct-09 8:41 
QuestionTerminateProcess() and windows messages. Pin
Souldrift29-Oct-09 4:23
Souldrift29-Oct-09 4:23 
AnswerRe: TerminateProcess() and windows messages. Pin
David Crow29-Oct-09 4:29
David Crow29-Oct-09 4:29 
AnswerRe: TerminateProcess() and windows messages. Pin
CPallini29-Oct-09 7:49
mveCPallini29-Oct-09 7:49 
AnswerRe: TerminateProcess() and windows messages. Pin
«_Superman_»29-Oct-09 7:59
professional«_Superman_»29-Oct-09 7:59 
QuestionGet window handle on which mouse button was clicked Pin
staticv29-Oct-09 3:53
staticv29-Oct-09 3:53 
QuestionRe: Get window handle on which mouse button was clicked Pin
David Crow29-Oct-09 4:25
David Crow29-Oct-09 4:25 
AnswerRe: Get window handle on which mouse button was clicked Pin
staticv29-Oct-09 5:12
staticv29-Oct-09 5:12 
AnswerRe: Get window handle on which mouse button was clicked Pin
David Crow29-Oct-09 5:19
David Crow29-Oct-09 5:19 
GeneralRe: Get window handle on which mouse button was clicked Pin
staticv29-Oct-09 5:34
staticv29-Oct-09 5:34 
GeneralRe: Get window handle on which mouse button was clicked Pin
transoft29-Oct-09 7:37
transoft29-Oct-09 7:37 
GeneralRe: Get window handle on which mouse button was clicked Pin
staticv29-Oct-09 7:58
staticv29-Oct-09 7:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.