Hello everyone, I am new to C++ (all the pros run yelling, "A noob is coming!!" lol) and I am enjoying all that I've learned so far. I have mainly been working with console applications (Plain C really using VC++ 6.0) in class. Our first quarter has ended and I started up a small project to keep myself in tune for the advanced C++ class coming up and to learn VS.Net 2003. I have ran into a problem that I really need help with. Please take it easy on me if I'm not clear or make some mistakes, I'm still a fresh student lol.
***Here is what I would like the program to do:
I would like to take all my old console applications, and put them into a GUI application using VS 2003 .NET. I have designed a form with a combobox, 2 buttons (Start and Exit), and a textbox in which I have stretched out to look like the console. My idea is to use the combobox to select a project from any given chapter, when the start button is clicked that program will run as it should if it were a console application! I want it to accept user input, use the data, and then display the output to the textbox/Console Emulator.
***Here is my problem:
I have successfully passed the textbox to a function called helloWorld and it writes text to the Console Emulator. The only problem that I have no idea how to do is somewhat "stop" or "pause" the program and let the user enter, then continue the rest of the program. Here is my code to show you what I mean.
Code:
#include "stdafx.h"
using namespace System;
//use System::Windows::Forms to minimize typing that plus TextBox *
using namespace System::Windows::Forms;
void helloWorld(TextBox *txtConsole, TextBox *txtResponse) //pass by pointer
{
String *answer;
txtConsole->AppendText("Hello World!");
txtConsole->AppendText("\n");
txtConsole->AppendText("How are you today? (good or bad) ");
Here is where I need to stop/pause the program in order to get the users response.
answer = txtResponse->Text;
if(answer == "Good" || answer == "good")
{
txtConsole->AppendText("\n");
txtConsole->AppendText("Thats GREAT!");
}
else
{
txtConsole->AppendText("\n");
txtConsole->AppendText("Bummer!");
}
}
I don't really know what to do at this point. I'm use to cin and cout methods of input and output. Can anyone give me some pointers (no pun intended) on what I could possibly do here?
***Also, is there anyway to put or use a console within a form? Like I did with the buttons/textbox's?
I am a newbie so bare with my level of detail please. Also, if you need more of my code I'll gladly put it up, but I think I've covered the jist of what I wanted too. (Is there a way to add an attachment to these forums?)