Hacer clic aquí para descargar el programa.
Working on Visual C++ 2005 on a Windows Forms Applicacion:
Trabajando en Visual C++ 2005 en una Aplicación de Windows Forms:
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
Personalized structure/Estructura personalizada
//We create the structure. Se crea la estructura.
struct estructura{
int unidadesvalorativas;
char nombredelamateria[50];
char nombredelalumno[50];
char nombredeldocente[50];
int ciclo;
int ano;
double notafinal;
int asistenciafinal;
int matricula;
};
estructura a, b;//We declare variables "a" and "b" from type "estructura", which is a personalized class or structure created right above. Se deblaran las variables "a" y "b" del tipo "estructura", que es una clase (class) o estructura (structure) personalizada que se acaba de crear anteriormente.
Code for button1/Código para el button1
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
//This For is to fill with blank spaces all of the values in the Char arrays so that they don't save values from former processes. Con este For se llenan de espacios en blanco todos los valores de los arreglos Char para que no queden valores de procesos anteriores.
for(int i=0;i<50;i++){
a.nombredelamateria[i]=' ';
a.nombredelalumno[i]=' ';
a.nombredeldocente[i]=' ';
}
//Introduce values to the structure from values introduces by the user on the textBox spaces. Introduce valores a la estructura desde los valores introducidos por el usuario en los textBox.
a.unidadesvalorativas=System::Convert::ToInt32(textBox1->Text);
for(int i=0;i<textBox2->Text->Length;i++)
a.nombredelamateria[i] = textBox2->Text[i];
for(int i=0;i
a.nombredelalumno[i]=textBox3->Text[i];
for(int i=0;i<textBox4->Text->Length;i++)
a.nombredeldocente[i]=textBox4->Text[i];
a.ciclo=System::Convert::ToInt32(textBox5->Text);//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
a.ano=System::Convert::ToInt32(textBox6->Text);
a.notafinal=System::Convert::ToDouble(textBox7->Text);
a.asistenciafinal=System::Convert::ToInt32(textBox8->Text);
a.matricula=System::Convert::ToInt32(textBox9->Text);
//All what is in a structure is sent to b structure. Todo lo que hay en la estructura a lo manda a otra estructura llamada b.
b=a;
}
Code for button2/Código para el button2
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
//It takes values from the structure to print them out on textBox spaces. Toma valores de la estructura y los imprime en los textBox.
textBox10->Text=String::Format("{0}",b.unidadesvalorativas);
textBox11->Text="";
for (int i = 0 ; i< 50; i++)
textBox11->Text += Char::ToString(b.nombredelamateria[i]);
textBox12->Text="";//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
for (int i = 0 ; i< 50; i++)
textBox12->Text += Char::ToString(b.nombredelalumno[i]);
textBox13->Text="";//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
for (int i = 0 ; i< 50; i++)
textBox13->Text += Char::ToString(b.nombredeldocente[i]);
textBox14->Text=String::Format("{0}",b.ciclo);//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
textBox15->Text=String::Format("{0}",b.ano);
textBox16->Text=String::Format("{0}",b.notafinal);
textBox17->Text=String::Format("{0}",b.asistenciafinal);
textBox18->Text=String::Format("{0}",b.matricula);
}
Jaime Montoya
webmaster@jaimemontoya.com
www.jaimemontoya.com
