Public Class Form_FinancialQuery_Development Dim m_Table As New System.Data.DataTable Dim m_InitOver As Boolean = False Public Shared cst_TABLE_NAME As String = "收支明细表_开发" Private Sub tsb_Query_Click(sender As Object, e As EventArgs) Handles tsb_Query.Click RefreshList() End Sub Private Function QueryAllFinancialItems() As Boolean Dim result As Boolean = False Dim strSQL As String = "SELECT * FROM `" & cst_TABLE_NAME & "` GROUP BY `序号`" m_Table.Rows.Clear() m_Table.Columns.Clear() If SQL_Query(COL_RIGHTS.财务管理, strSQL, m_Table) = True Then result = True End If Return result End Function Private Function RefreshList() As Boolean QueryAllFinancialItems() Grid1.AllowUserSort = True Grid1.DisplayFocusRect = False Grid1.ExtendLastCol = True Grid1.DisplayRowArrow = True Grid1.BoldFixedCell = False Grid1.SortIndicatorStyle = FlexCell.SortIndicatorStyleEnum.Light3D '绑定到数据源时可以指定固定行数,但绑定后不能改变Grid.FixedRows属性的值 'Grid1.SetDataBinding(m_Table, "products", True, 2) Grid1.SetDataBinding(m_Table, "", True, 1) CGirdInfo.LoadGridInfo("财务管理_查询", Grid1) Grid1.Locked = True Return True End Function Private Sub Grid1_ColWidthChange(Sender As Object, e As FlexCell.Grid.ColWidthChangeEventArgs) Handles Grid1.ColWidthChange CGirdInfo.SaveGirdInfo("财务管理_查询", Grid1) End Sub Private Sub tsb_ExportToExcel_Click(sender As Object, e As EventArgs) Handles tsb_ExportToExcel.Click Dim dlg As New SaveFileDialog dlg.DefaultExt = "xls" dlg.Filter = "Excel File (*.xls)|*.xls" If dlg.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return End If If Grid1.ExportToExcel(dlg.FileName, True, False) = True Then MsgBox("导出为Excel OK!") Else MsgBox("导出为Excel Error!") End If End Sub End Class