Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How-To:MacroSubsitution
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
How-To:MacroSubsitution
Divers
Thread ID:
01238242
Message ID:
01238242
Vues:
46
I have a listbox on a form, when the user select an item in the list, I want to run that report. The reports are based off report classes (active reports). I'd like to have it dynamic so I can just pull the name from the listbox and run it, and not setup a big case statement. But I don't know how to replace the line that creates the report object (rpt_sch_Standard_Schedule in the example below.

Any help appreciated.

Thanks
Kirk
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string myRptClassName;
            myRptClassName = listBox1.Text;
            string myCommand;
            myCommand = myRptClassName.Trim() + " rpt = new " + myRptClassName.Trim() + "()";

            //Need to replace next line with some type of 
            //macro substitution based off the value in the myRptClassName variable
            // foxpro would be
            // myCommand=allt(myRptClassName)+[ rpt = new ]+allt(myRptClassName)+[()]
            // &myCommand

            rpt_sch_Standard_Schedule rpt = new rpt_sch_Standard_Schedule();
            
            this.viewer1.Document = rpt.Document;
            rpt.Run();            

        }
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform