السلام عليكم
حبيت اشارك فى هذا المنتدى الجميل بموضوع يعتبر شيق بالنسبة لمبرمجين قواعد البيانات
وهو كيفية استخدام dataGridView
اضافة الاعمدة الى الاداة الاكثر شهرة فى بيئة الدوت نت وهى datagridview
لنفترض ان الشاشة التى نعمل عليها هيا اذن ادخال بضاعة الى المخزن
الكود الاول ملئ datagridview بالاعمده
public ref class gridv
{
public:
DataGridViewComboBoxColumn^ goodsgrid;
DataGridViewTextBoxColumn^ textgrid1;
DataGridViewTextBoxColumn^ textgrid2;
DataGridViewTextBoxColumn^ textgrid3;
DataGridViewTextBoxColumn^ textgrid4;
DataGridViewTextBoxColumn^ textgrid5;
void getcombo1()
{
goodsgrid=gcnew DataGridViewComboBoxColumn();
textgrid1=gcnew DataGridViewTextBoxColumn();
textgrid2=gcnew DataGridViewTextBoxColumn();
textgrid3=gcnew DataGridViewTextBoxColumn();
textgrid4=gcnew DataGridViewTextBoxColumn();
textgrid5=gcnew DataGridViewTextBoxColumn();
goodsgrid->HeaderText="اسم الصنف";
goodsgrid->Name ="colum1";
goodsgrid->Width=200;
textgrid1->HeaderText="الكمية";
textgrid1->Name ="colum2";
textgrid1->Width =75;
textgrid1->MaxInputLength=4;
textgrid2->HeaderText="التجزئة";
textgrid2->Name ="colum3";
textgrid2->Width =75;
textgrid2->MaxInputLength=4;
textgrid3->HeaderText="السعر";
textgrid3->Name ="colum4";
textgrid3->Width =75;
textgrid3->MaxInputLength=8;
textgrid4->HeaderText="الاجمالى";
textgrid4->Name ="colum5";
textgrid4->Width =75;
textgrid4->ReadOnly=true;
textgrid5->HeaderText="تاريخ الصلاحية";
textgrid5->Name ="colum6";
textgrid5->Width =100;
textgrid5->MaxInputLength=10;
}
};
}هنا قمنا بعمل كلاس لملئ الاعمده فى datagridview
استدعاء class
gridv ^comgrid=gcnew gridv();
وضع الاعمده بال datagridview
this->dataGridView1->Columns->Add(comgrid->goodsgrid); this->dataGridView1->Columns->Add(comgrid->textgrid1); this->dataGridView1->Columns->Add(comgrid->textgrid2); this->dataGridView1->Columns->Add(comgrid->textgrid3); this->dataGridView1->Columns->Add(comgrid->textgrid4); this->dataGridView1->Columns->Add(comgrid->textgrid5);
وده يبقى اول درس فى التعامل مع datagridview
وباذن الله نكمل مع بعض
ارجو ان اكون اوفيت فى الشرح