Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

15 Experts available now in Live!

Get 1:1 Help Now