Access the Text Box by the Name
Contents
[
Hide
]
Access the Text Box by the Name
Earlier, text boxes are accessed by index from the Worksheet.TextBoxes collection but now you can also access the text box by name from this collection. This is a convenient and quick way to access your text box if you already know its name.
The following sample code first creates a text box and assigns it some text and name. Then in the next lines, we access the same text box by its name and print its text.
C# code to access the text box by name
Console output generated by the sample code
Here is the console output of the above sample code.
This is MyTextBox