Public Sub htmlExport() Dim gvEx As New System.Web.UI.WebControls.GridView gvEx.AutoGenerateColumns = True gvEx.AllowSorting = False gvEx.AllowPaging = False Dim stringWrite As New System.IO.StringWriter Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite) gvEx.DataSource = Me.DataSource gvEx.DataBind() gvEx.RenderControl(htmlWrite) WriteFile(Me.FileName, stringWrite.ToString()) End Sub