How to create a MDI form that uses RDP to access multiple servers?

  • Thread starter Thread starter Trypod33
  • Start date Start date
T

Trypod33

Guest
How to create a MDI form that uses RDP to access multiple servers?

I have no trouble creating RDP forms and I can create MDI forms but the moment I put a RDP form into the MDI form it crashes.

Code looks like this:

Parent form:

Public Class Form1
Private Sub Paap01ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles Paap01ToolStripMenuItem.Click
Dim frm2 As New ChildForm2
frm2.MdiParent = Me
frm2.Show()
End Sub
End Class
Child form:

Imports MSTSCLib
Public Class ChildForm2
Private Sub ChildForm2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try

rdpView.Server = "--------"

rdpView.UserName = "--------"


Dim isSecured As IMsTscNonScriptable =
DirectCast(rdpView.GetOcx(), IMsTscNonScriptable)

isSecured.ClearTextPassword = "---------"

rdpView.Connect()

Catch ex As Exception
MessageBox.Show("Cannot Connect", "Cannot Connect to: " + "------" + " Reason: " + ex.Message,
MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try
End Sub

Private Sub DisconnectToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DisconnectToolStripMenuItem.Click
Try
If rdpView.Connected.ToString() = "1" Then
rdpView.Disconnect()
End If
Catch ex As Exception
MessageBox.Show("Cannot Disconnect",
"Cannot Disconnect from: " + "------" + " Reason: " + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class

Continue reading...
 
Back
Top