PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?TWljaGFlbA==?=
Guest
Posts: n/a
 
      20th Jul 2006
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.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWljaGFlbA==?=
Guest
Posts: n/a
 
      20th Jul 2006
Never mind....I just had my object mispelled. Sorry for being such a
newbie.

Michael.




"Michael" wrote:

> 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.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class definition c676228 Microsoft C# .NET 5 23rd Jan 2009 02:47 AM
about class definition tony Microsoft C# .NET 4 16th Aug 2006 08:21 PM
BUG VC7.1: in class friend template function definition does not have access to the class's template parameters Maxim Yegorushkin Microsoft VC .NET 5 6th Jun 2004 02:56 AM
displaying text from a different class into Form1.textBox1 polarz Microsoft C# .NET 3 5th Feb 2004 09:27 AM
Class Definition Question Z GIRL Microsoft Dot NET 3 5th Jan 2004 08:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:17 AM.