|
-
May 25th, 2009, 01:51 AM
#1
from vc++ 6.0 to vc++ 2008
Hi,
I was using vc++ 6.0 long time ago and downloaded the 2008 express recently. When I tried to write a new MFC program, I found that the structure was changed a lot.
1. For example, function codes of OK_Click(when "ok" button is clicked) was move from .cpp to .h. Therefore i am not sure whether I should declare the global variables. Should I place them in location 1 or 2 (highlighted in green below)?
2. When I tried to declare an array with defined structure (highlighted in red below), it doesn't work! I have searched some posts in the net and tried syntax like array<route_data^>^route=gcnew array<route_data^> (100); but still failed. What I want is to build an array with 100 blank entries of several fileds named "type","name"...and will be filled with data after user click the "ok" button.
Please kindly help! Thank you.
--------------------------------------------
Code:
#pragma once
namespace TrafficReport
{
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::Text;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ EXIT;
protected:
private: System::Windows::Forms::Button^ OK;
private: System::Windows::Forms::Label^ label4;
........
private:
/// Required designer variable.
<location 2> String^ path;
String^ initPath;
String^ msg;
ref struct route_data
{
String^ MSC;
String^ Type;
String^ Dir;
String^ Name;
int dev;
float cap;
String^ Date;
String^ Hr;
float Erl;
float Loading;
} route[100];
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->EXIT = (gcnew System::Windows::Forms::Button());
this->OK = (gcnew System::Windows::Forms::Button());
this->label4 = (gcnew System::Windows::Forms::Label());
....
}
#pragma endregion
private: System::Void OK_Click(System::Object^ sender, System::EventArgs^ e)
{
...
}
};
}
Last edited by Cassie Tsui; May 25th, 2009 at 02:05 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|