Hello,
I was wondering how I can go about interacting with the a radgridview on an active documentwindow. Here is my scenario:
1. Using a RadRibon form
2. Using RadDock with Autodetect MDI form
3 toolwindow with TreeView.
4. TreeView is filled from a dataset / datatable which is filled from SQL database
each node of the tree view has a unique SQL statement associated with it. This is my code when doubleclicking the node:
the public variable SqlreportStr is set so the Report form can read it and run the query
The problem that I have is that this form could be open several times at once displaying different data as the SQL queries are differnet. Also looking at the name of the form it comes accorss as Form_Report1, Form_report2 etc depending on what instance of the form that it is.
I am looking to be able to do the following with the girds:
1. export to excel
2. process each row of the grids in order to make other database changes.
if some one could point me to how I could exactly about interacting with the gridview i would greatly appreciate it.
thanks!
Jonathan
I was wondering how I can go about interacting with the a radgridview on an active documentwindow. Here is my scenario:
1. Using a RadRibon form
2. Using RadDock with Autodetect MDI form
3 toolwindow with TreeView.
4. TreeView is filled from a dataset / datatable which is filled from SQL database
each node of the tree view has a unique SQL statement associated with it. This is my code when doubleclicking the node:
Private Sub TV_Reports_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TV_Reports.MouseDoubleClick Try Dim filter As String = "ID='" & TV_Reports.SelectedNode.Tag.ToString & "'" For Each row As DataRow In ds.Tables("TreeView_Reports").Select(filter) If row("Menu_Type").ToString = "Report" Then Me.SqlReportStr = row("Sql_Query") Me.Parent_StatusStripLabel.Text = "Running report: " & row("Name") Me.Parent_StatusStrip.Update() Me.Parent_StatusStrip.Refresh() Dim frm As New Form_Report frm.Text = "Report: " & row("Name") frm.MdiParent = Me frm.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable frm.Dock = DockStyle.Fill frm.WindowState = FormWindowState.Maximized frm.Show() End If NextCatch ex As Exception End TryEnd Subthe public variable SqlreportStr is set so the Report form can read it and run the query
Public Class Form_Report Dim ds As New DataSet Dim DT_Report_Results As New DataTable("ReportResults") Dim SqlReportStr As String = Nothing Dim jobcount As Integer = 0 Private Sub Form_Report_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed ds.Clear() ds.Dispose() Me.Dispose() Me.Cursor = Cursors.Default GC.Collect() GC.WaitForPendingFinalizers() GC.WaitForFullGCComplete() GC.WaitForFullGCApproach() GC.Collect() End Sub Private Sub Form_Report_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ds.Tables.Add(DT_Report_Results) SqlReportStr = Form_Parent.SqlReportStr Me.Cursor = Cursors.WaitCursor Dim Search_Worker As New BackgroundWorker jobcount += 1 AddHandler Search_Worker.DoWork, New DoWorkEventHandler(AddressOf StartReportFill) AddHandler Search_Worker.RunWorkerCompleted, _ New RunWorkerCompletedEventHandler(AddressOf Search_worker_RunWorkerCompleted) Search_Worker.RunWorkerAsync() Search_Worker.Dispose() End Sub Private Sub StartReportFill(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) FillSqlDs("ReportResults", SqlReportStr) End Sub Private Sub Search_worker_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs) jobcount -= 1 GridLayout() Me.Cursor = Cursors.Default End Sub Private Sub GridLayout() Try GV_Reports.DataSource = ds GV_Reports.DataMember = "ReportResults" Catch ex As Exception MsgBox(ex.Message) End Try GV_Reports.Columns("Sys_ID").IsVisible = False Form_Parent.Parent_StatusStripLabel.Text = "Ready!" Form_Parent.Parent_StatusStrip.Update() Form_Parent.Parent_StatusStrip.Refresh() End Sub Private Sub FillSqlDs(ByVal tbl As String, ByVal qry As String) If Form_Parent.MyConnection.State = ConnectionState.Closed Then Form_Parent.MyConnection.Open() End If 'Using Form_Parent.MyConnection Dim Dadapter As New SqlDataAdapter Using Dadapter Try Dadapter.SelectCommand = New SqlCommand(qry, Form_Parent.MyConnection) Dadapter.Fill(ds, tbl) Catch ex As Exception MsgBox(ex.Message) End Try End Using End SubEnd ClassThe problem that I have is that this form could be open several times at once displaying different data as the SQL queries are differnet. Also looking at the name of the form it comes accorss as Form_Report1, Form_report2 etc depending on what instance of the form that it is.
I am looking to be able to do the following with the girds:
1. export to excel
2. process each row of the grids in order to make other database changes.
if some one could point me to how I could exactly about interacting with the gridview i would greatly appreciate it.
thanks!
Jonathan