Bücher,C undC#TrainingsfürProgrammierer c schulungen, C# Schulungen, Bücher über c mit Visual Studio




Download 1,28 Mb.
bet6/8
Sana20.02.2024
Hajmi1,28 Mb.
#159175
1   2   3   4   5   6   7   8
Bog'liq
www rkaiser de c-winforms-tutorial
JORAYEV.SH, Tavsifnoma F, O`zbеkiston Rеspublikasi (1), 1-mavzu «Talaffuzi og‘ir bolalar bilan ishlash metodikasi» fani, Korrespondensiya (3), Korrespondensiya (3), 3-mavzu.google uchun vaqtincha, 1.1.1, Dunyoqarashning mohiyati1-mustaqil ish, O’rnatilgan tizimlarda rfid-fayllar.org, 1-mustaqil ishi topshirdi D. Egamberdiyev Qabul qildi G`aniyev A, AZIMOVA DURDONA, KAMCHIBEKOVA RAYXONOY KKKK, 7- amaliy ish Mavzu Openssl kutubxonasidan foydalangan holda ma

4. Calling the functions


By double-clicking the button on the form, Visual Studio creates the function (the event handler) that will be called when the button is clicked when the program is running:
private: System::Void
button_plus_1_Click(System::Object^ sender,
System::EventArgs^ e)
{
}
In this event handler you then call the corresponding function. In this simple tutorial this is the function plus_1 from the file Header.h.
If this function uses user input, you read it in via a TextBox. In this simple tutorial, it will be a number that is read from the in_TextBox.
If a parameter of the called function does not have type String (the type of the property in_textBox→Text), the string must be converted to the type of the parameter. This is possible with one of the Convert:: functions. The results are to be displayed in the out_textBox. This can be done with the function out_textBox→AppendText. The string that AppendText expects can be created with String::Format. In the first argument (a string) you specify 0 for the first value after the string, 1 for the second and so on.
private: System::Void
button_plus_1_Click(System::Object^ sender,
System::EventArgs^ e)
{
int n = Convert::ToInt32(in_textBox->Text); int result = plus_1(n); out_textBox->AppendText(String::Format("plus_1({0})=
{1}\r\n",n,result));
}
If you enter a number in the input field after starting this program with F5 and then click on the button, the value incremented by 1 is displayed in the output text box:

For each further function whose result is to be displayed, a button is placed on the form and given a suitable name (Name property) and a suitable label (Text property). This function is then called in the associated event handler.
With this all relevant parts of the ??? CppCLR_Winforms_GUI are presented. You can enhance it as you like with additional controls (buttons, menus, etc.). See chapter 2 of mybookfor more information.

Download 1,28 Mb.
1   2   3   4   5   6   7   8




Download 1,28 Mb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Bücher,C undC#TrainingsfürProgrammierer c schulungen, C# Schulungen, Bücher über c mit Visual Studio

Download 1,28 Mb.