|
Public Class Form1
Inherits System.Windows.Forms.Form
'instantiate object in form
'& then setup interface object
Protected maSQLRep As New maSQLReport.Reports("", _
"", "", "", 1, 2, 3, 4, 5, 6)
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TreeView1 As System.Windows.Forms.TreeView
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents ListView1 As System.Windows.Forms.ListView
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtSourceURL As System.Windows.Forms.TextBox
Friend WithEvents txtDestinationURL As System.Windows.Forms.TextBox
Friend WithEvents Button6 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.TreeView1 = New System.Windows.Forms.TreeView
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.Button1 = New System.Windows.Forms.Button
Me.ListView1 = New System.Windows.Forms.ListView
Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader
Me.ColumnHeader3 = New System.Windows.Forms.ColumnHeader
Me.Button2 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button3 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.txtSourceURL = New System.Windows.Forms.TextBox
Me.txtDestinationURL = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Button6 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'TreeView1
'
Me.TreeView1.ImageList = Me.ImageList1
Me.TreeView1.Location = New System.Drawing.Point(16, 88)
Me.TreeView1.Name = "TreeView1"
Me.TreeView1.Size = New System.Drawing.Size(392, 216)
Me.TreeView1.TabIndex = 0
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(24, 312)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Load Tree "
'
'ListView1
'
Me.ListView1.AllowColumnReorder = True
Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader3})
Me.ListView1.FullRowSelect = True
Me.ListView1.GridLines = True
Me.ListView1.LabelWrap = False
Me.ListView1.Location = New System.Drawing.Point(16, 352)
Me.ListView1.Name = "ListView1"
Me.ListView1.Size = New System.Drawing.Size(392, 168)
Me.ListView1.TabIndex = 2
Me.ListView1.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Text = "Name"
Me.ColumnHeader1.Width = 200
'
'ColumnHeader2
'
Me.ColumnHeader2.Text = "Type"
'
'ColumnHeader3
'
Me.ColumnHeader3.Text = "Source"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(152, 312)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 3
Me.Button2.Text = "Select"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(16, 528)
Me.Button4.Name = "Button4"
Me.Button4.TabIndex = 6
Me.Button4.Text = "Migrate"
'
'ListBox1
'
Me.ListBox1.HorizontalScrollbar = True
Me.ListBox1.Location = New System.Drawing.Point(432, 88)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.SelectionMode = System.Windows.Forms.SelectionMode.None
Me.ListBox1.Size = New System.Drawing.Size(352, 433)
Me.ListBox1.TabIndex = 7
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(432, 528)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 8
Me.Button3.Text = "Clear"
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(240, 312)
Me.Button5.Name = "Button5"
Me.Button5.TabIndex = 9
Me.Button5.Text = "DeSelect"
'
'txtSourceURL
'
Me.txtSourceURL.Location = New System.Drawing.Point(120, 8)
Me.txtSourceURL.Name = "txtSourceURL"
Me.txtSourceURL.Size = New System.Drawing.Size(568, 20)
Me.txtSourceURL.TabIndex = 10
Me.txtSourceURL.Text = "http://(local)/reportserver/reportservice.asmx"
'
'txtDestinationURL
'
Me.txtDestinationURL.Location = New System.Drawing.Point(120, 40)
Me.txtDestinationURL.Name = "txtDestinationURL"
Me.txtDestinationURL.Size = New System.Drawing.Size(568, 20)
Me.txtDestinationURL.TabIndex = 11
Me.txtDestinationURL.Text = "http://{YourRemoteServer}/reportserver/reportservice.asmx"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 8)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 12
Me.Label1.Text = "Source Server"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(16, 40)
Me.Label2.Name = "Label2"
Me.Label2.TabIndex = 13
Me.Label2.Text = "Destination Server"
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(704, 24)
Me.Button6.Name = "Button6"
Me.Button6.TabIndex = 14
Me.Button6.Text = "SetURL"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(792, 557)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtDestinationURL)
Me.Controls.Add(Me.txtSourceURL)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.ListView1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TreeView1)
Me.Name = "Form1"
Me.Text = "maSQLReporting Object Tester"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Load tree with items from source server
'
TreeView1.Nodes.Clear()
Me.Cursor = Cursors.WaitCursor
TreeView1.Nodes.Add(New TreeNode("TEST NODE", 5, 6))
'getReportTree returns a populated treenode
Try
TreeView1.Nodes.Add(maSQLRep.getReportTree("/")) 'If path specified, would start there
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Me.Cursor = Cursors.Default
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Add selected node to list
'
'One way to find out if it's a SQL node is to test the type. Might be a little expensive
If TreeView1.SelectedNode.GetType.Equals(New maSQLReport.Reports.RSItemNode().GetType) Then
'the tag object of the SQL nodes will have a pre-populated listViewItem
Try '- Should do some sort of test instead of using the Exception
'to catch the fact that item already exists.
ListView1.Items.Add(TreeView1.SelectedNode.Tag)
Catch ex As System.ArgumentException
'MsgBox(ex.Message)
Catch ex As Exception
'Bubble it if we aren't catching it
Throw (ex)
End Try
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'Run migration for items in list
'
Dim warnings As New ArrayList
Me.Cursor = Cursors.WaitCursor
For Each item As ListViewItem In ListView1.Items
Try
warnings.AddRange(maSQLRep.MigrateDev2Stage(item.Text))
If Not warnings Is Nothing Then
For Each warning As maSQLReport.SQLReportingServices.Warning In warnings
ListBox1.Items.Add(warning.Message)
Next
End If
warnings.Clear()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Next
Me.Cursor = Cursors.Default
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'Remove selected items from list
'
Dim items2Delete As ListView.SelectedListViewItemCollection = ListView1.SelectedItems
For Each item As ListViewItem In items2Delete
ListView1.Items.Remove(item)
Next
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'Clear results listbox
ListBox1.Items.Clear()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
setURL()
End Sub
Private Sub setURL()
'Object tester only uses Dev & Stage.
maSQLRep.DevURL = txtSourceURL.Text
maSQLRep.StageURL = txtDestinationURL.Text
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
setURL()
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I've been playing around with computers since I started programming in about 1979. On punch cards. (that was an Explorer program in 4th grade) I ran a BBS in the late '80s for the 4 years I was in college for the first time... but ended up in the theater department.
After a dropping out for a while, my flirtation with being a studio recording engineer lead to a BS in EET - after which I ended up somehow being a network admin / tech support person.
I then taught high school electronics for a while... before leaving for the exciting world of restaurant managment.
I gave it up, however, to get a second degree in IT/Software Design - and now the circle is complete, I'm back in programming; primarly ASP.NET / Classic ASP business apps.