الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Datagrid C#

بدأه faresc# في 5 أبريل 2008 · 4 رد · 858 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Al Salaam Alykom wa Rahmato Allah wa Barakto

Sorry i don't have Arabic keyboard so i'll try to mix arabic with English

I study c# so i have to do 2 classes the first is Invoice,and the 2nd is Invoice detail;so i have to make 2 windows form in c#;and in the 1st windows i have to put DataGridView and then bind the data from the 1class.

But my problem is when You click op any foeld of record in the data grid(Form1 for example) you should go to the details of the invoice in the 2nd form2?

ill show u my 1 class whic is invoice (or factuur in Dutch language)

 class factuur

{

private int _factuurnummer;

private string _datum;

private double _totaalbedrag;

private ArrayList _factuurLijnen;



// constructor

public factuur()

{

_factuurnummer = 1;

_datum = null;

_totaalbedrag = 0;

_factuurLijnen = null;

}

// second Constructor

public factuur(int _factuurnummer,string _datum,double _totaalbedrag,ArrayList _factuurLijnen)

{

this._factuurnummer=_factuurnummer;

this._datum=_datum;

this._totaalbedrag=_totaalbedrag;

this._factuurLijnen=_factuurLijnen;

}

Hona sawf aktoB alkood how to bind the datasource to the Datagrid

private void Form1_Load(object sender, EventArgs e)

{

DataTable fadi_Awad = new DataTable();

fadi_Awad.Columns.Add("factuurNummer");

fadi_Awad.Columns.Add("Datum");

fadi_Awad.Columns.Add("Totaal");

fadi_Awad.Columns.Add("FactuurLijn");

dataGridView1.DataSource = fadi_Awad;

}

But my Main problem is when i don't know what i must do when i click on one cell of the data then can see the details in another form

Shokran keteer

#2

Salam Alykom

I forget to Attach my Zip(File).

If somebody don't understand what i mean ,so when U to codes look maybe can help me?practicum19.zip

#3

Salam Alykom

Ana aref leesh ma hada yate al feedback ala hada al soaal(question) lano al code maktoob be loga not English ,lahaza ana sawf aktob shi ager.

So I reepat i don't have Arabic keyboard (samhoni)

I have to make an invoice in c#,so i have to make 2 classes, the first class is invoice and the second is invice detail

and when you click on the cell of the datagridview1 you can see the detail of the invoice in the another windows from,en that's is my problem you can look to the codes above ,so this is my difficult events at this moment

Shokran keeteer

تم تعديل هذه المشاركة بواسطة faresc# في 16 أبريل 2008 في 22:45

#4

السلام عليكم ورحمة الله وبركاته

WindowsApplication14.zip

#5

Alsalam Alykom wa rahmato Allah wa Barakto

My Sister shokran keteer for your example Barak Allah feki

Thanks alot for this code i added alittle bit only 3 lines

textBox1.Clear();

textBox2.Clear();

textBox3.Clear();

and your original codes are

DataRow dr = dt.NewRow();

dr["id"] = textBox1.Text;

dr["Name"] = textBox2.Text;

dr["Address"] = textBox3.Text;

dt.Rows.Add(dr);

Ala Kol haal 90% i learned from you how to switch between 2 forms(thanks alot for the 2nd time),BUT BUT that's not all i'm working now when you want to change the value of the cell in the first form automatically the value must be change in the second;

I think i must use somthening like that but i'm not sure

dataGridView1.Refresh();

Ala Kol haal ana ashkorki jazeela alshokr

مواضيع مشابهة