Реферат: Послідовні інтерфейси ПК
this->Controls->Add (this->label3);
this->Controls->Add (this->label2);
this->Controls->Add (this->label1);
this->Controls->Add (this->textBox1);
this->Controls->Add (this->button3);
this->Controls->Add (this->button2);
this->Controls->Add (this->button1);
this->Controls->Add (this->comboBox1);
this->Name = L «Form1»;
this->Text = L «COM Комутнікатор»;
this->Load += gcnew System: EventHandler (this, &Form1: Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System: Void Form1_Load (System: Object^ sender, System: EventArgs^ e) {
array<String^>^ ports = serialPort1->GetPortNames();
int i = 0;
comboBox1->Items->Clear();
for (i = 0; i < ports->Length; i++) {
comboBox1->Items->Add (ports[i]);
}
comboBox1->SelectedIndex = 0;
comboBox2->SelectedIndex = 7;
}
private: System: Void button2_Click (System: Object^ sender, System: EventArgs^ e) {
String^ portName = (String^) comboBox1->SelectedItem;
array<unsigned char>^ buffer = gcnew array<unsigned char>(1000);
unsigned int bytesRead = 0;