Hi,
Im trying to export data from my grid to the excel using UltraGridExcelExporter.
below is my code and the datagrid has data in it, but at the line "Me.UltraGridExcelExporter1.Export(Me.grdViewEdit, myStream)", Im getting the "Object reference not set to an instance of an object." error.
Can anyone please help?
Code:
Private Sub UltraButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click Dim myStream As String Dim saveFileDialog1 As New SaveFileDialog() saveFileDialog1.Filter = "Excel Files (*.xls)|*.xls" saveFileDialog1.FilterIndex = 2 saveFileDialog1.RestoreDirectory = True If saveFileDialog1.ShowDialog() = DialogResult.OK Then myStream = saveFileDialog1.FileName() Me.UltraGridExcelExporter1.Export(Me.grdViewEdit, myStream) End If End Sub
My guess is that this exception is occurring in your code, probably in an event handler of one of the grid's events. It might help if you posted the entire call stack, or set Visual Studio to break on all exceptions so you can see the actual line of code on which the exception occurs.