add rdp control to tab control as additional tabs are created

Posted on 2012-09-18
Last Modified: 2012-09-19
I working on an RDP client. My plan is to integrate this with other tools I have created for work.  I have a menustrip, tabcontrol and a rdp control on the first tab.  For now, I have setup the app to add a new tab when a user clicks connect.  This works great.  What I cant figure out is how to add another rdp control to the new tab.  Any help would be great.

Imports MSTSCLib

Public Class frmMain
    Private Sub ConnectToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConnectToolStripMenuItem.Click
        If AddTab() Then
        End If
    End Sub

    Private Sub DisconnectToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisconnectToolStripMenuItem.Click

        TabControl1.Visible = True

    End Sub

    Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        TabControl1.Width = Me.Width - 35
        TabControl1.Height = Me.Height - 110
    End Sub

    Private Function AddTab()
            Dim myTabPage As New TabPage()
            myTabPage.Text = "NewTab" & (TabControl1.TabPages.Count + 1)
            Return True

        Catch ex As Exception
            Return False
        End Try

    End Function

    Private Sub rdpConnect()
        If rdp.Connected.ToString() = "0" Then
                rdp.Server = "***.***.***"
                rdp.UserName = "User"
                Dim secured As IMsTscNonScriptable = DirectCast(rdp.GetOcx(), IMsTscNonScriptable)
                secured.ClearTextPassword = "Pass"
            Catch ex As Exception
                MessageBox.Show(ex.Message, Me.Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
        End If
    End Sub
End Class

Open in new window

Question by:NCSA SCADA

    Author Comment

    Any help experts?
    LVL 83

    Accepted Solution

    RDP is just a control so you can instantiate it in code and add it to tab control


    Dim rdp as new RDPClient
    rdp.width = 600
    rdp.height = 400
    rdp.left = 10 = 20


    Author Closing Comment

    I was making this way to hard.... thanks for the help

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now