473,657 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing Form Methods

I have constructed the following form:

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

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

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

}

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 GenerateControl s(). Why? Are you not allowed to
access methods of classes that are derived from Form? =\

Nov 15 '05 #1
2 6175
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**********@y ahoo.com> wrote in message
news:3F******** ******@yahoo.co m...
I have constructed the following form:

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

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

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

}

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 GenerateControl s(). 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**********@y ahoo.com> wrote in message
news:3F******** ******@yahoo.co m...
I have constructed the following form:

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

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

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

}

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 GenerateControl s(). 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
15099
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 the field values and write them to an ASCII file on the hard drive. Can anyone confirm that this is even possible? I have dredged up one article "Accessing the Internet Explorer Document Object Model from Visual Basic 5.0" (Asmi, 1998) that covers...
5
3645
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 parent class, and I can't make some "helper" class a friend of the parent class to help in accessing the data.) Problem: I want to derive a class that has a copy constructor that properly copies those data members.
6
4338
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 application everything works just fine. However, if I call the methods in this DLL from a web service, I receive the following error when the database connection is opened: Error: ORA-12154: TNS:could not resolve service name Does anyone know...
2
1695
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 here; } public displaystuffinwindow() { display stuff here; } }
1
1380
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 to retrieve the size of the form's data as it i POSTED. I have tried accessing this using the HTTPRequest object's InputStream
2
1228
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 on my form - it basically contains all the logic behind the form. I will be calling these methods from the form class but am not sure how I can access the datagrid from outside the form. Should my class inherit the form so that it has access to...
5
2798
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 and from the public folder on the client machine. It is not a public web service, only accessible on intranet. The anonymous access is disabled. Windows authentication is enabled. Web.Config sets <identity impersonate="true" /> Using a test app,...
3
4995
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 : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
3
2209
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 where the form code is but how do i get to the controls themselves. newbie in the class world.. still trying to figure it all out :) Thanks for any help...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.