Click here to Skip to main content
15,922,696 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to create Unique Named Objects in a loop Pin
MarkB1231-Jul-09 7:01
MarkB1231-Jul-09 7:01 
GeneralRe: How to create Unique Named Objects in a loop Pin
Luc Pattyn1-Jul-09 8:04
sitebuilderLuc Pattyn1-Jul-09 8:04 
QuestionSend query to a search engine!! Pin
Nafiseh Salmani1-Jul-09 4:58
Nafiseh Salmani1-Jul-09 4:58 
AnswerRe: Send query to a search engine!! Pin
led mike1-Jul-09 5:46
led mike1-Jul-09 5:46 
GeneralRe: Send query to a search engine!! Pin
Nafiseh Salmani1-Jul-09 6:14
Nafiseh Salmani1-Jul-09 6:14 
GeneralRe: Send query to a search engine!! Pin
led mike1-Jul-09 6:31
led mike1-Jul-09 6:31 
QuestionThread of a delegate Pin
TheLaTouf1-Jul-09 3:43
TheLaTouf1-Jul-09 3:43 
AnswerRe: Thread of a delegate Pin
Ennis Ray Lynch, Jr.1-Jul-09 4:11
Ennis Ray Lynch, Jr.1-Jul-09 4:11 
AnswerRe: Thread of a delegate Pin
Nicholas Butler1-Jul-09 4:32
sitebuilderNicholas Butler1-Jul-09 4:32 
GeneralRe: Thread of a delegate Pin
TheLaTouf1-Jul-09 4:40
TheLaTouf1-Jul-09 4:40 
QuestionAutomatic download attachment from emails Pin
spankyleo1231-Jul-09 3:36
spankyleo1231-Jul-09 3:36 
AnswerRe: Automatic download attachment from emails Pin
c0ax_lx1-Jul-09 3:55
c0ax_lx1-Jul-09 3:55 
AnswerRe: Automatic download attachment from emails Pin
moon_stick1-Jul-09 5:09
moon_stick1-Jul-09 5:09 
GeneralRe: Automatic download attachment from emails Pin
spankyleo1231-Jul-09 8:57
spankyleo1231-Jul-09 8:57 
GeneralRe: Automatic download attachment from emails Pin
moon_stick1-Jul-09 9:18
moon_stick1-Jul-09 9:18 
GeneralRe: Automatic download attachment from emails Pin
moon_stick1-Jul-09 9:22
moon_stick1-Jul-09 9:22 
GeneralRe: Automatic download attachment from emails Pin
spankyleo1231-Jul-09 9:57
spankyleo1231-Jul-09 9:57 
GeneralRe: Automatic download attachment from emails Pin
moon_stick1-Jul-09 11:13
moon_stick1-Jul-09 11:13 
QuestionCut, Copy & Paste from variable text boxes Pin
Martin310881-Jul-09 3:20
Martin310881-Jul-09 3:20 
AnswerRe: Cut, Copy & Paste from variable text boxes Pin
Eddy Vluggen1-Jul-09 3:39
professionalEddy Vluggen1-Jul-09 3:39 
GeneralRe: Cut, Copy & Paste from variable text boxes Pin
Baeltazor1-Jul-09 7:39
Baeltazor1-Jul-09 7:39 
GeneralRe: Cut, Copy & Paste from variable text boxes Pin
Eddy Vluggen1-Jul-09 8:20
professionalEddy Vluggen1-Jul-09 8:20 
GeneralRe: Cut, Copy & Paste from variable text boxes Pin
Baeltazor1-Jul-09 20:28
Baeltazor1-Jul-09 20:28 
AnswerRe: Cut, Copy & Paste from variable text boxes Pin
DaveyM691-Jul-09 3:46
professionalDaveyM691-Jul-09 3:46 
AnswerRe: Cut, Copy & Paste from variable text boxes Pin
Luc Pattyn1-Jul-09 3:49
sitebuilderLuc Pattyn1-Jul-09 3:49 
Hi,

You can't just get directly to a TextBox when all you know is its name.
Here is a little snippet that would do something akin to what you want, assuming your class
is a Form or whatever Container that is holding the TextBoxes:

public string GetTextBoxText(string name) {
    string text=null;
    foreach(Control c in Controls) {
        TextBox tb=c as TextBox;
        if (tb!=null && tb.Name==name) text=tb.SelectedText;
    }
    return text;
}


BTW: If some of your TextBoxes are located deeper in the Control hierarchy, you would have to adapt for that.

PS: as Dave said, if you would hold a reference to the ActiveControl, rather than just holding its name, you could get to its text right away!

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.