Solved

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

Posted on 2012-04-05
4
864 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 36

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 36

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Import MySQL data into MS Access using VB.Net interface 5 69
Data organization issue 7 56
Get sourcecode path 14 64
How do i create a simple array in a public class? 6 38
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…

752 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