473,411 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

function??

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;
}

May 24 '06 #1
1 1177
"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;
}

Jun 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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) {...
5
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...
2
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...
2
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
8
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...
3
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'...
2
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: ...
28
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) {
4
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){
7
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.