Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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