private void fillGhabzInfo() { grdDataViewGhabz.AutoGenerateColumns = true; ghabz gh = new ghabz(); gh.stdno = txtstdno.Text; grdDataViewGhabz.DataSource = gh.SelectbyStdId(); string[] col_headers = { "شماره قبض", "ش هنرجویی", "نام و نام خانوادگی", "کلاس", "تاریخ", "تاریخ پایان تسویه", "ماه تسویه", "هزینه دوره", "مبلغ دریافتی", "توضیحات" }; int[] col_width = { 70, 60, 120, 90, 80, 80, 70, 70, 70, 180 }; for (int i = 0; i < col_headers.Length; i++) { grdDataViewGhabz.Columns[i].HeaderText = col_headers[i].ToString(); grdDataViewGhabz.Columns[i].Width = col_width[i]; } DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; grdDataViewGhabz.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); dataGridViewCellStyle1.Format = "N0"; dataGridViewCellStyle1.NullValue = null; grdDataViewGhabz.Columns["mablagh"].DefaultCellStyle = dataGridViewCellStyle1; grdDataViewGhabz.Columns["paid"].DefaultCellStyle = dataGridViewCellStyle1; }
private void UpdateGhabz() { ghabz gh = new ghabz(); gh.stdno = txtstdno.Text; ghabzGridView.DataSource = gh.SelectbyStdId(); ghabzGridView.AutoGenerateColumns = true; string[] col_headers = { "شماره قبض", "ش هنرجویی", "نام و نام خانوادگی", "کلاس", "تاریخ", "تاریخ پایان تسویه", "ماه تسویه", "مبلغ", "توضیحات" }; int[] col_width = { 70, 60, 120, 90, 80, 80, 70, 70, 180 }; for (int i = 0; i < col_headers.Length; i++) { ghabzGridView.Columns[i].HeaderText = col_headers[i].ToString(); ghabzGridView.Columns[i].Width = col_width[i]; } DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle(); objAlternatingCellStyle.BackColor = Color.Khaki; ghabzGridView.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle; }