'Class' does not contain a definition for 'TextBox1'

G

Guest

Hi all,
I am writing a piece of code that creates a dynamic number of textboxes on
a form. Then I want to update them from another class in my project.

When I try I get a Compiler Error CS0117.
Here is some sample code:

Form1.cs:

FileWatcher fw = new FileWatcher();

public FileProcess()
{
//Code here for dynamically creating 5 text boxes.

fw.FileWatcherStart(this);
}


FileWatcher.cs:

public void FileWatcherStart(FileProcess myFileProcess)
{
myFileProcess.txtResults[1].Text = "MIKE";
}


If I comment out the textbox update line and step through my code and then
run the line: myFileProcess.txtResults[1].Text = "MIKE"; from the immediate
window, it works. Just wont run if i uncomment it. What do I need to do to
give my dynamically generated textboxes a definition?

Thanks,
Michael.
 
G

Guest

Never mind....I just had my object mispelled. :( Sorry for being such a
newbie.

Michael.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top