Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2006

Tip: Looking for answers? Try searching our database.

function??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joshua siew - 24 May 2006 08:47 GMT
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::CenterScreen;
    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;
}
Ben Voigt - 05 Jun 2006 14:44 GMT
> 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...
>
[quoted text clipped - 165 lines]
> return 0;
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.