2

Quick question.

Using VS2012, .net framework 4.5, VB on win7 x64.

Trying to create a message holder in my status bar, to display long exception messages when something goes wrong in my app. I had an idea of using a ToolStripSplitButton and adding to its items a textbox. So when an exception occurs, the ToolStripSplitButton icon changes to indicate failure and if the user wants to know why, he clicks the ToolStripSplitButton which in turn will pop up the textbox.

When my form first loads, I change the properties of this textbox. I make it wider and longer & multiline.

ToolStripTextBox1.Multiline = True
ToolStripTextBox1.Width = 600
ToolStripTextBox1.Height = 300
ToolStripTextBox1.WordWrap = False

Only things is that this type of textbox will not accept scrollbars.

ToolStripTextBox1.ScrollBars = Windows.Forms.ScrollBars.Vertical

Seems like Microsoft has disabled its functionality?

Any thoughts on getting this box to scroll somehow?

conanDrum
  • 215
  • 2
  • 7
  • If anybody can shed some light on this issue, please post a comment. If you need more info let me know. – conanDrum Dec 12 '12 at 02:00

1 Answers1

1

You could try implementing your own version of the ToolStripTextBox as a custom user control and add it to the ToolStrip. The textbox on the user control would be a regular textbox which allows vertical scroll bars.

Community
  • 1
  • 1
Adam
  • 2,762
  • 1
  • 30
  • 32
  • thanks for the suggestion. I tried just changing the declaration in the form.designer.vb where is says Me.ToolStripTextBox1 = New System.Windows.Forms.ToolStripTextBox(). I changed it to Me.ToolStripTextBox1 = New System.Windows.Forms.TextBox() and it seems that normal textboxes are not allowed on ToolStrips. Do you have any idea how this can be circumvented? – conanDrum Dec 12 '12 at 11:33
  • @conanDrum, you can create a custom user control that inherits ToolStripItem which contains your textbox as described in my answer or alternatively use ToolStripContainerHost. – Adam Dec 12 '12 at 12:07
  • I will try when I get a chance. It is weird that I have to do this when MS could have just left it alone! Go figure... – conanDrum Dec 12 '12 at 15:15
  • 1
    @Axel, Worked fine for me in a small test project. – Adam Dec 12 '13 at 22:47