Dear all who is nice,
I'm the DUMBEST person on earth who just started to use VC++....
need some help on the below coding....please check the NOTE section....
thanks in advanced...
=================================
#using <mscorlib.dll>
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
__gc class frmStart : public Form
{
public:
frmStart();
private:
String* UserSelect_str;
Label *fxcommUserSelDisp_lab; // Declare an instance to a Label class
// Declare an instance to a ComboBox class and also the events
ComboBox *fxcomm_cbox;
void evtSelectionChanged(Object *Sender, EventArgs *Args);
// Declare an instance to a Button class and also the events
Button *exit_btn;
void evtExitButtonClick(Object *Sender, EventArgs *Args);
Button *execute_btn;
void evtExecuteButtonClick(Object *Sender, EventArgs *Args);
//Declare every fx comm as a subproc
void subBRInit(); void subWRInit(); void subBWInit(); void subWWInit();
};
frmStart::frmStart()
{
this->StartPosition =
System::Windows::Forms::FormStartPosition::CenterS creen;
this->Size = System::Drawing::Size(568, 260);
// The caption of the form
this->Text = S"MITSUBISHI: Fx Communication selection...";
// Declare all the neccessary controls in the forms
// Use the instance of the combo box to initialize the class
fxcomm_cbox = new ComboBox;
fxcomm_cbox->DropDownStyle = ComboBoxStyle::DropDownList; // ComboBox Style
fxcomm_cbox->Size = Drawing::Size(72, 21); // Width & Height
fxcomm_cbox->Location = Point(4, 16); // position the combo box X & Y
// Add each item to the combo box according to fx communication commands
fxcomm_cbox->Items->Add(S"BR");
fxcomm_cbox->Items->Add(S"WR");
fxcomm_cbox->Items->Add(S"BW");
fxcomm_cbox->Items->Add(S"WW");
fxcomm_cbox->Items->Add(S"BT");
fxcomm_cbox->Items->Add(S"WT");
fxcomm_cbox->Items->Add(S"RR");
fxcomm_cbox->Items->Add(S"RS");
fxcomm_cbox->Items->Add(S"PC");
fxcomm_cbox->Items->Add(S"GW");
fxcomm_cbox->Items->Add(S"__");
fxcomm_cbox->Items->Add(S"TT");
// fxcomm_cbox->Text = S"BR"; // Specific first display
// Add the Combo box events of user selection
fxcomm_cbox->add_SelectedIndexChanged(new EventHandler(this,
evtSelectionChanged));
// After creating the control, add it to the form control
this->Controls->Add(fxcomm_cbox);
exit_btn = new Button;
exit_btn->Text = S"E&XIT";
exit_btn->Location = Point(488, 212);
exit_btn->Size = Drawing::Size(64, 20);
exit_btn->FlatStyle = FlatStyle::Flat;
exit_btn->add_Click(new EventHandler(this, evtExitButtonClick));
this->Controls->Add(exit_btn);
execute_btn = new Button;
execute_btn->Text = S"E&XIT";
execute_btn->Location = Point(388, 212);
execute_btn->Size = Drawing::Size(64, 20);
execute_btn->FlatStyle = FlatStyle::Flat;
execute_btn->add_Click(new EventHandler(this, evtExecuteButtonClick));
this->Controls->Add(execute_btn);
fxcommUserSelDisp_lab = new Label;
fxcommUserSelDisp_lab->Location = Point(80, 16);
fxcommUserSelDisp_lab->Size = Drawing::Size(472, 184);
fxcommUserSelDisp_lab->BackColor = Drawing::Color::LightCyan;
// fxcommUserSelDisp_lab->Text = S"BR";
this->Controls->Add(fxcommUserSelDisp_lab);
// ENF declare all the neccessary controls in the forms
}
void frmStart::evtSelectionChanged(Object *Sender, EventArgs *Args)
{
UserSelect_str = fxcomm_cbox->Text;
fxcommUserSelDisp_lab->Text = "In progress...please be patient.";
if ( String::Compare( UserSelect_str, "BR" ) == 0 )
{ subBRInit(); }
else if ( String::Compare( UserSelect_str, "WR" ) == 0 )
{ subWRInit(); }
else if ( String::Compare( UserSelect_str, "BW" ) == 0 )
{ subBWInit(); }
else if ( String::Compare( UserSelect_str, "WW" ) == 0 )
{ subWWInit(); }
else if ( String::Compare( UserSelect_str, "BT" ) == 0 )
{ }
else if ( String::Compare( UserSelect_str, "WT" ) == 0 )
{ }
else if ( String::Compare( UserSelect_str, "RR" ) == 0 )
{ }
else if ( String::Compare( UserSelect_str, "RS" ) == 0 )
{ }
else if ( String::Compare( UserSelect_str, "PC" ) == 0 )
{ }
else if ( String::Compare( UserSelect_str, "GW" ) == 0 )
{ }
else if ( String::Compare( UserSelect_str, "__" ) == 0 )
{ }
}
void frmStart::subBRInit()
{
fxcommUserSelDisp_lab->Text = "Bit devices read in units of 1 point.";
}
void frmStart::subWRInit()
{
String* s = String::Concat(S"Bit devices read in units of 16 point, \r\n");
s = String::Concat(s, S"or word devices read in units of 1 point.");
fxcommUserSelDisp_lab->Text = s;
}
void frmStart::subBWInit()
{
fxcommUserSelDisp_lab->Text = "Bit devices written in units of 1 point.";
}
void frmStart::subWWInit()
{
fxcommUserSelDisp_lab->Text = "Bit devices written in units of 16 point,
or word devices read in units of 1 point.";
}
void frmStart::evtExecuteButtonClick(Object *Sender, EventArgs *Args)
{
//NOTE: I need the below value is a RETURN result by passing 1 parameter
//PLEASE LET ME KNOW WHERE SHOULD I DECLARED THE FUNCTION AND HOW TO
//USE IT....thanks a lot
fxcommUserSelDisp_lab->Text = "test";
}
void frmStart::evtExitButtonClick(Object *Sender, EventArgs *Args)
{ this->Close(); }
int __stdcall WinMain()
{
frmStart *SF = new frmStart();
Application::Run(SF);
return 0;
} 1 1163
"joshua siew" <jo********@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com... Dear all who is nice,
I'm the DUMBEST person on earth who just started to use VC++.... need some help on the below coding....please check the NOTE section....
If you just started, then you are wasting your time with Managed C++. MC++
is dead. VS2005 (the express edition is a free download and many
opportunities to get standard edition free too, i.e. learn2asp.net) uses a
new syntax C++/CLI for programming .NET applications. thanks in advanced...
================================= #using <mscorlib.dll> #using <System.dll> #using <System.Drawing.dll> #using <System.Windows.Forms.dll>
using namespace System; using namespace System::Drawing; using namespace System::Windows::Forms;
__gc class frmStart : public Form { public: frmStart();
private: String* UserSelect_str;
Label *fxcommUserSelDisp_lab; // Declare an instance to a Label class
// Declare an instance to a ComboBox class and also the events ComboBox *fxcomm_cbox; void evtSelectionChanged(Object *Sender, EventArgs *Args);
// Declare an instance to a Button class and also the events Button *exit_btn; void evtExitButtonClick(Object *Sender, EventArgs *Args);
Button *execute_btn; void evtExecuteButtonClick(Object *Sender, EventArgs *Args);
//Declare every fx comm as a subproc void subBRInit(); void subWRInit(); void subBWInit(); void subWWInit();
};
frmStart::frmStart() {
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterS creen; this->Size = System::Drawing::Size(568, 260);
// The caption of the form this->Text = S"MITSUBISHI: Fx Communication selection...";
// Declare all the neccessary controls in the forms // Use the instance of the combo box to initialize the class fxcomm_cbox = new ComboBox; fxcomm_cbox->DropDownStyle = ComboBoxStyle::DropDownList; // ComboBox Style fxcomm_cbox->Size = Drawing::Size(72, 21); // Width & Height fxcomm_cbox->Location = Point(4, 16); // position the combo box X & Y // Add each item to the combo box according to fx communication commands fxcomm_cbox->Items->Add(S"BR"); fxcomm_cbox->Items->Add(S"WR"); fxcomm_cbox->Items->Add(S"BW"); fxcomm_cbox->Items->Add(S"WW"); fxcomm_cbox->Items->Add(S"BT"); fxcomm_cbox->Items->Add(S"WT"); fxcomm_cbox->Items->Add(S"RR"); fxcomm_cbox->Items->Add(S"RS"); fxcomm_cbox->Items->Add(S"PC"); fxcomm_cbox->Items->Add(S"GW"); fxcomm_cbox->Items->Add(S"__"); fxcomm_cbox->Items->Add(S"TT"); // fxcomm_cbox->Text = S"BR"; // Specific first display // Add the Combo box events of user selection fxcomm_cbox->add_SelectedIndexChanged(new EventHandler(this, evtSelectionChanged)); // After creating the control, add it to the form control this->Controls->Add(fxcomm_cbox);
exit_btn = new Button; exit_btn->Text = S"E&XIT"; exit_btn->Location = Point(488, 212); exit_btn->Size = Drawing::Size(64, 20); exit_btn->FlatStyle = FlatStyle::Flat; exit_btn->add_Click(new EventHandler(this, evtExitButtonClick)); this->Controls->Add(exit_btn);
execute_btn = new Button; execute_btn->Text = S"E&XIT"; execute_btn->Location = Point(388, 212); execute_btn->Size = Drawing::Size(64, 20); execute_btn->FlatStyle = FlatStyle::Flat; execute_btn->add_Click(new EventHandler(this, evtExecuteButtonClick)); this->Controls->Add(execute_btn);
fxcommUserSelDisp_lab = new Label; fxcommUserSelDisp_lab->Location = Point(80, 16); fxcommUserSelDisp_lab->Size = Drawing::Size(472, 184); fxcommUserSelDisp_lab->BackColor = Drawing::Color::LightCyan; // fxcommUserSelDisp_lab->Text = S"BR"; this->Controls->Add(fxcommUserSelDisp_lab);
// ENF declare all the neccessary controls in the forms
}
void frmStart::evtSelectionChanged(Object *Sender, EventArgs *Args) { UserSelect_str = fxcomm_cbox->Text;
fxcommUserSelDisp_lab->Text = "In progress...please be patient.";
if ( String::Compare( UserSelect_str, "BR" ) == 0 ) { subBRInit(); } else if ( String::Compare( UserSelect_str, "WR" ) == 0 ) { subWRInit(); } else if ( String::Compare( UserSelect_str, "BW" ) == 0 ) { subBWInit(); } else if ( String::Compare( UserSelect_str, "WW" ) == 0 ) { subWWInit(); } else if ( String::Compare( UserSelect_str, "BT" ) == 0 ) { } else if ( String::Compare( UserSelect_str, "WT" ) == 0 ) { } else if ( String::Compare( UserSelect_str, "RR" ) == 0 ) { } else if ( String::Compare( UserSelect_str, "RS" ) == 0 ) { } else if ( String::Compare( UserSelect_str, "PC" ) == 0 ) { } else if ( String::Compare( UserSelect_str, "GW" ) == 0 ) { } else if ( String::Compare( UserSelect_str, "__" ) == 0 ) { } }
void frmStart::subBRInit() { fxcommUserSelDisp_lab->Text = "Bit devices read in units of 1 point."; } void frmStart::subWRInit() { String* s = String::Concat(S"Bit devices read in units of 16 point, \r\n"); s = String::Concat(s, S"or word devices read in units of 1 point."); fxcommUserSelDisp_lab->Text = s; } void frmStart::subBWInit() { fxcommUserSelDisp_lab->Text = "Bit devices written in units of 1 point."; } void frmStart::subWWInit() { fxcommUserSelDisp_lab->Text = "Bit devices written in units of 16 point, or word devices read in units of 1 point."; }
void frmStart::evtExecuteButtonClick(Object *Sender, EventArgs *Args) { //NOTE: I need the below value is a RETURN result by passing 1 parameter //PLEASE LET ME KNOW WHERE SHOULD I DECLARED THE FUNCTION AND HOW TO //USE IT....thanks a lot fxcommUserSelDisp_lab->Text = "test"; }
void frmStart::evtExitButtonClick(Object *Sender, EventArgs *Args) { this->Close(); } int __stdcall WinMain() { frmStart *SF = new frmStart(); Application::Run(SF); return 0; } This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: phil_gg04 |
last post by:
Dear Javascript Experts,
Opera seems to have different ideas about the visibility of Javascript
functions than other browsers. For example, if I have this code:
if (1==2) {
function...
|
by: laredotornado |
last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to
have my Javascript function execute from the BODY's "onload" method,
but if there is already an onload method defined, I would...
|
by: sushil |
last post by:
+1 #include<stdio.h>
+2 #include <stdlib.h>
+3 typedef struct
+4 {
+5 unsigned int PID;
+6 unsigned int CID;
+7 } T_ID;
+8
+9 typedef unsigned int (*T_HANDLER)(void);
+10
|
by: Olov Johansson |
last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7
and Konqueror 3.5) has support not only for standard function
definitions, function expressions (lambdas) and Function...
|
by: Beta What |
last post by:
Hello,
I have a question about casting a function pointer. Say I want to make
a generic module (say some ADT implementation) that requires a function
pointer from the 'actual/other modules'...
|
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: ...
|
by: Larax |
last post by:
Best explanation of my question will be an example, look below at this
simple function:
function SetEventHandler(element)
{
// some operations on element
element.onclick =
function(event)
{
|
by: alex |
last post by:
I am so confused with these three concept,who can explained it?thanks
so much?
e.g.
var f= new Function("x", "y", "return x * y");
function f(x,y){
return x*y
}
var f=function(x,y){
|
by: VK |
last post by:
I was getting this effect N times but each time I was in rush to just
make it work, and later I coudn't recall anymore what was the original
state I was working around. This time I nailed the...
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |