Textbox -> Tabs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DarkArchon
    New Member
    • Mar 2008
    • 11

    Textbox -> Tabs

    I'm writing a simple text viewer whereby double clicking an item in a given listbox loads the appropriate text in a textbox. Now I need to be able to double click on multiple items from the listbox and display them each in a different tab, what is the easiest way of doing this?
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    • Select the listbox property selectionmode = multisimple .
    • You should write your selection code in a command button.
    • Use a for loop to place all selected text in the textbox.

    All the best.
    Note: you should give appropriate topic “How Do I Select Multiple rows in listbox control ” followed by your C# or VB .Net Code version.

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      If you want to put your results in tabs, you can use the TabControl.

      Here is a method I wrote to add tabs to a tab control. I added some code to add a textbox to the tab, but you'll need to customize that part.
      Code:
      //c#, but you can convert to VB easily if you need to
      //using statements
      .
      .
      .
      private int tabCount = 2; //how ever many tabs that you start with
      .
      .
      //constructors
      .
      .
      private void CreateNewTab(string tabTitle, string textForTextBox)
      {
      	tabControl1.TabPages.Add("tab" + tabCount, tabTitle); 
      	tabControl1.TabPages[tabCount].CreateControl();
      	tabControl1.TabPages[tabCount].BackColor = Color.White;
      	TextBox tb = new TextBox();
      	tb.Text = textForTextBox;
      	tabControl1.TabPages[tabCount].Controls.Add(tb);
      	tb.Left = 10;
      	tb.Top = 10;
      	tabCount++;
      }

      Comment

      Working...