Solved

Excel Add-in VB.net add text to a TextBox from ribbon

Posted on 2012-04-05
4
844 Views
Last Modified: 2012-04-08
Hi

I used this article to open and close a Custom Task Pane
http://msdn.microsoft.com/en-us/library/bb608590.aspx

but I also need to insert a value into a TextBox on the same Custom Task Pane
from the ribbon. How would I make this TextBox available to the project?
0
Comment
Question by:murbro
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 37817841
The textbox is added as a private field to the user control, you can either add a public property or a get method to your user control.
e.g.  textBox1 is your target textBox
Public ReadOnly Property MyTextBox() As TextBox
    Get
        Return textBox1
    End Get
End Property

and then on your ribbon code use taskPaneControl1.MyTextBox to access it.
0
 

Author Comment

by:murbro
ID: 37818578
Hi. I did that and also used the following code to make the TaskPane available but
  Globals.ThisAddIn.Where_TaskPane. does not give access to the textBox1

Public ReadOnly Property Where_TaskPane() As Microsoft.Office.Tools.CustomTaskPane
        Get
            Return taskPaneValue
        End Get
    End Property
0
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 37820399
By ribbon code, I mean ThisAddIn.vb.

If you want to access the textbox outside the ribbon code, you need to add this codein your ribbon code:
Public ReadOnly Property MyTaskPaneControl As TaskPaneControl
        Get
            Return taskPaneControl1
        End Get
    End Property
Then you can write:
Globals.ThisAddIn.MyTaskPaneControl.MyTextBox.
0
 

Author Closing Comment

by:murbro
ID: 37821698
Fantastic. That worked! Thanks very much
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

10 Experts available now in Live!

Get 1:1 Help Now