Visual Basic 2010 - Need help

Discussion in 'Programming General' started by VPf2, Nov 23, 2010.

Visual Basic 2010 - Need help
  1. Unread #1 - Nov 23, 2010 at 8:36 AM
  2. VPf2
    Joined:
    May 1, 2007
    Posts:
    48
    Referrals:
    0
    Sythe Gold:
    0

    VPf2 Member

    Visual Basic 2010 - Need help

    Hey,

    I need a simple tip. What is the correct code to create a new tab with a DockStyle.Fill RichTextBox (in a DotNetBar.SuperTabControl) when you click a button. I'm at a loss >_<

    Here's my app:
    [​IMG]

    And the code. You'll probably see what I'm trying to do:
    [​IMG]
     
  3. Unread #2 - Jan 28, 2011 at 11:33 AM
  4. dzmuL
    Joined:
    Jan 22, 2011
    Posts:
    27
    Referrals:
    0
    Sythe Gold:
    0

    dzmuL Member
    Banned

    Visual Basic 2010 - Need help

    TeachMecomputer on youtube has good tutorials. check them out mate.
     
  5. Unread #3 - Feb 12, 2011 at 7:38 PM
  6. Nemesis4895
    Joined:
    Oct 7, 2010
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Nemesis4895 Member
    Banned

    Visual Basic 2010 - Need help

    This might help

    Code:
    Private Sub AddTab(Optional ByVal file As String = Nothing)
        Dim NewTab As New TabPage 'Create a new tab
        Dim NewRTB As New RichTextBox 'Create a new richtextbox
    
        Dim TabText As String = "Untitled" 'Text for the tab. Default is "Untitled"
        Dim RTBText As String = Nothing 'Text for the richtextbox. Default is Nothing
    
        If Not IsNothing(file) Then 'If a file was set
            If My.Computer.FileSystem.FileExists(file) Then 'If the file exists
                NewRTB.Tag = file 'Set the file as the new richtextbox's tag for later use
                TabText = My.Computer.FileSystem.GetFileInfo(file).Name 'Get the filename
                Dim reader As New System.IO.StreamReader(file) 'Create a reader to read the file
                RTBText = reader.ReadToEnd 'Read all the text of the file
                reader.Close() ' Close the reader
            Else
                MsgBox("Sorry that file doesn't exist") 'Inform the user if the file doesn't exist
            End If
        End If
    
        NewTab.Text = TabText 'Set the tabs text
        NewTab.Tag = NewRTB 'Set the richtextbox as the Tab's tag for later use
    
        NewRTB.Parent = NewTab 'Make the richtextbox a child of the tag
        NewRTB.Dock = DockStyle.Fill 'Make the richtextbox fill the tabpage
        NewRTB.Text = RTBText 'Set the richtextbox's text
    
        TabControl1.TabPages.Add(NewTab) 'Add the tab to the tabcontrol
        TabControl1.SelectedTab = NewTab 'Focus on the new tab
        Tab = NewTab 'Set the current tab to NewTab
        RTB = NewRTB 'Set the current richtextbox to NewRTB
    End Sub
    
    
     
< webbrowser question | Need Some Help "Rs Account Creator" >

Users viewing this thread
1 guest


 
 
Adblock breaks this site