Using crystaldecisions.crystalreports.Engine;
Namespace GMEDicine {///
private CrystalDecisions.Windows.Forms.CrystalReportViewer crvGMedicine; private GMedicine.RPTGMedicine rptGMedicine; private System.Windows.Forms.ComboBox cbxSelectGroup; private void FormGMedicine_Load (object sender, System.EventArgs e) {LoadFormulaList ();
CRVGMedicine.reportsource = rPTGMedicine;
CRVGMedicine.refreshreport ();
Private void cbxselectgroup_selectedindIndexchanged (Object Sender, System.EventArgs E) {FormulafieldDefinition Formulafield;
Formulafield = getformulafield (rPTGMedicine, formula_field_name);
Formulafield.text = cbxselectgroup.selectedItem.toString ();
CrvgMedicine.refreshreport ();} Private formulafieldDefinition getformulafield (ReportDocument Report, String formulafieldname) {FormulafieldDefinition formulafield;
/ / Get formulafielddefinition, // and return this object by name. formulaField = Report.DataDefinition.FormulaFields [formulaFieldName]; if (! formulaField = null) return formulaField; else return null;} private void LoadFormulaList () {foreach (string formula in FORMULA_FIELD_TEXT) {cbxSelectGroup.Items.Add (formula);} }}}