Solved

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

Posted on 2012-04-05
4
856 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
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 shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

820 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