473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Accessing Form Methods

I have constructed the following form:

public class Form1 : System.Windows.Forms.Form
{
//code here to declare components
....
public void GenerateNodes()
{
FillDirectoryTree(tvwSource, true);
FillDirectoryTree(tvwTarget, false);
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

}
//end of class Form1
.....more code

[STAThread]
static void Main()
{
System.Windows.Forms.Form theForm = new Form1();
theForm.GenerateNodes();

}

I want to call the public methods that I have associated with Form1.
However whenever I try to implement them through an instance of Form1 I
get a build error saying that "System.Windows.Forms.Form" does not
contain a definition for GenerateControls(). Why? Are you not allowed to
access methods of classes that are derived from Form? =\

Nov 15 '05 #1
2 6158
right, because you have declared theForm as a System.Windows.Forms.Form, not
a Form1

The method you defined in Form1 is not available in the base class
System.Windows.Forms.Form

Declare as:

Form1 theForm

not:

System.Windows.Forms.Form theForm
HTH

"0 x deadbeef" <se**********@yahoo.com> wrote in message
news:3F**************@yahoo.com...
I have constructed the following form:

public class Form1 : System.Windows.Forms.Form
{
//code here to declare components
...
public void GenerateNodes()
{
FillDirectoryTree(tvwSource, true);
FillDirectoryTree(tvwTarget, false);
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

}
//end of class Form1
....more code

[STAThread]
static void Main()
{
System.Windows.Forms.Form theForm = new Form1();
theForm.GenerateNodes();

}

I want to call the public methods that I have associated with Form1.
However whenever I try to implement them through an instance of Form1 I
get a build error saying that "System.Windows.Forms.Form" does not
contain a definition for GenerateControls(). Why? Are you not allowed to
access methods of classes that are derived from Form? =\

Nov 15 '05 #2
OMG....duhhh....man I need sleep
mia lanui wrote:
right, because you have declared theForm as a System.Windows.Forms.Form, not
a Form1

The method you defined in Form1 is not available in the base class
System.Windows.Forms.Form

Declare as:

Form1 theForm

not:

System.Windows.Forms.Form theForm
HTH

"0 x deadbeef" <se**********@yahoo.com> wrote in message
news:3F**************@yahoo.com...
I have constructed the following form:

public class Form1 : System.Windows.Forms.Form
{
//code here to declare components
...
public void GenerateNodes()
{
FillDirectoryTree(tvwSource, true);
FillDirectoryTree(tvwTarget, false);
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

}
//end of class Form1
....more code

[STAThread]
static void Main()
{
System.Windows.Forms.Form theForm = new Form1();
theForm.GenerateNodes();

}

I want to call the public methods that I have associated with Form1.
However whenever I try to implement them through an instance of Form1 I
get a build error saying that "System.Windows.Forms.Form" does not
contain a definition for GenerateControls(). Why? Are you not allowed to
access methods of classes that are derived from Form? =\



Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture...
5
by: Suzanne Vogel | last post by:
Hi, Given: I have a class with protected or private data members, some of them without accessor methods. It's someone else's class, so I can't change it. (eg, I can't add accessor methods to the...
6
by: Jeff | last post by:
Has anyone had any luck accessing an Oracle database from a web service? I have a C# DLL with various code to query an Oracle database. If I call the methods in this DLL from a Windows Forms...
2
by: Greg Merideth | last post by:
Using Visual C# I created two forms such as namespace test { public class SystemTray : System.Windows.Forms.Form { public createwindow() { stuff here; } public fadewindow() { stuff to fade...
1
by: spalding | last post by:
Hi I have a situation in which I need to find out how much data has bee posted during a form's POST method. The amount of data I am posting is large (the form includes a fil input) and I wish...
2
by: Parveen | last post by:
I have a data grid on a windows form that I want to access from another class that's outside the form but in the same project. This other class stores all methods that populate and modify the grid...
5
by: Khalique | last post by:
Hi everyone, I Hope that someone will be able to give me a hint to the solution to my problem. I have developed a web service (vb.net) that needs to access the folders / files and copy files to...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
3
by: M K | last post by:
I have 2 classes. One where the form resides and I created another one for all the database stuff. after i get data from the db i want to be able to update the form. I have the namespace of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.