Estoy tratando de crear un reporte con crystal, este es mi codigo

RepositorioAlumno alumnos = new RepositorioAlumno();
            dsAlumno dsa = new dsAlumno();

            foreach (Alumno alu in alumnos.ListaAlumnos())
            {
                DataRow row = dsa.Tables["Alumno"].NewRow();
                row["POID"] = alu.POID;
                row["Matricula"] = alu.Matricula;
                row["Paterno"] = alu.Paterno;
                row["Materno"] = alu.Materno;
                row["Nombre"] = alu.Nombre;
                row["NoCuenta"] = alu.NoCuenta;
                row["JDE"] = alu.JDE;

                dsa.Tables["Alumno"].Rows.Add(row);
            }

            dsa.Tables["Alumno"].AcceptChanges();
            Reporte r1 = new Reporte(); <--- segui el primer consejo sobre
el instanciar
            r1.SetDataSource(dsa.Tables["Alumno"]);

            crvReporte.ReportSource = r1; <---- pero ahora me aparecio este
            crvReporte.Refresh();

Aqui esta el error


No se controló System.NullReferenceException
  Message="Referencia a objeto no establecida como instancia de un objeto."
  Source="SystemSAI"
  StackTrace:
       en SystemSAI.frmReporte..ctor() en C:\Documents and
Settings\augusto.ferriz\Mis documentos\Visual Studio
2008\Projects\SAI\SystemSAI\frmReporte.cs:línea 39
       en SystemSAI.frmMenu.btnCargarReporte_Click(Object sender, EventArgs
e) en C:\Documents and Settings\augusto.ferriz\Mis documentos\Visual Studio
2008\Projects\SAI\SystemSAI\frmMenu.cs:línea 603
       en System.Windows.Forms.Control.OnClick(EventArgs e)
       en System.Windows.Forms.Button.OnClick(EventArgs e)
       en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
       en System.Windows.Forms.Control.WndProc(Message& m)
       en System.Windows.Forms.ButtonBase.WndProc(Message& m)
       en System.Windows.Forms.Button.WndProc(Message& m)
       en
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
       en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
       en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
       en
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
       en
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
       en
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
       en System.Windows.Forms.Application.Run(Form mainForm)
       en SystemSAI.Program.Main() en C:\Documents and
Settings\augusto.ferriz\Mis documentos\Visual Studio
2008\Projects\SAI\SystemSAI\Program.cs:línea 29
       en System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
args)
       en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
       en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       en System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       en System.Threading.ThreadHelper.ThreadStart()
  InnerException:


saludos

-- 
Para escribir al Grupo, hágalo a esta dirección: 
[email protected]
Para más, visite: http://groups.google.com/group/NHibernate-Hispano

Responder a