Tuesday, January 29, 2013

Modification of a report, mavariable is at null, what should I do to change that and to be able to display the report for changings

Modification of a report, mavariable is at null, what should I do to change that and to be able to display the report for changings

Here is an extract of the code. There I don't know what to add as code to make it funtion... For the moment I can create a report but I cannot modify it... That's the part concerning modifications...

 protected override void OnNavigatedTo(NavigationEventArgs e)         {             ReLoadListInDB();             if (NavigationContext.QueryString["action"].Equals("create"))             {                 act°IsCreate = true;                 lblRapportAdd.Text = "Création d'un rapport";                 textboxRapportT.Text = "Titre automatique à déterminer";                 dpRapDeb.SelectedDate = DateTime.Now;                 //cbboxRapportChoixPeriode.SelectedIndex = 1;             }            else             {                 actionIsCreate = false;                 lblRapportAdd.Text = "Modification d'un rapport";                   web_ReportingReportT mavariable = App.Rapport;                    textboxRapport.Text = mavariable.Title;                 dpRapDeb.SelectedDate = mavariable.DateStart;                 dpRapportFin.SelectedDate = mavariable.DateEnd;                 cbboxRapportChoixFrequence.SelectedItem = mavariable.web_RapportingFreq;             } 

The debugger stops on this part of the code: web_ReportingReport mavariable = App.Rapport; and it explains that the reference of the object is not defined at an instance of an object, mavariable is thus at the moment null. When I select a recordline in fact a specific report and I clic on the event modify, it bugs.

Here is another extract of the code which can help to the complete comprehension and where it's perhaps also necessary to add some code... If you need more explanations, don't hesitate to ask me

protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)     {         base.OnNavigatingFrom(e);         if (demandeModification)         {             if (radGridViewRapportAuto.SelectedItem != null)                 App.Rapport = radGridViewRapportAuto.SelectedItem as web_Reportg;             if (demandeModification == false || radGridViewRapportAuto.SelectedItem == null)             {                 //demandeModification = false;                 MessageBox.Show("Un rapport doit être sélectionné", "Erreur", MessageBoxButton.OK);                 e.Cancel = true;             }                      }          } 

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog