473,378 Members | 1,344 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,378 software developers and data experts.

winapp: how to call a procedure from a class

nev
251 100+
if i add a new class1 in my program and i placed a public sub procedure in it, how will i call the procedure from form1? please help me find a link that answers this or please answer if you can. thank you and more power.
Jan 2 '08 #1
5 1058
camel
55
Class1 classInstance = new Class1();
classInstance.MethodName();

Or if its a static method just Class1.MethodName()
Jan 3 '08 #2
nev
251 100+
thank you camel. i forgot to mention the class1 i created was an object. just like when creating another form2 in my project.

when i have form1 and form2,
then i place a public sub in form2:

public sub test()
'sample
end sub

i can perform that sub procedure when i'm in form1 by:

form2.test()

knowing this, i tried putting that public sub inside a class1 object but when i place this code in form1:

class1.test()

it errors. what may be wrong?
Jan 4 '08 #3
camel
55
Sorry I cannot follow your explanation of the problem, frustrating as I expect it would be easy to fix if only I was clearer quite what it was :)
Jan 4 '08 #4
camel
55
Is it not just that you need an instance of class1 before calling its method (as per my previous answer), whilst the Form2 you refer to was already instantiated (i.e. loaded) when you called its method successfully?
Jan 4 '08 #5
nev
251 100+
Is it not just that you need an instance of class1 before calling its method (as per my previous answer), whilst the Form2 you refer to was already instantiated (i.e. loaded) when you called its method successfully?
ohhh, i just have to create the procedures as a shared sub :-)
Jan 28 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
0
by: Eugene Safrankow | last post by:
Hello All! I've encountered with the error when I call a method of dependency library (written in managed VC++) from Smart Client placed on a web page. In general, I make a call to the Windows...
4
by: Jean-Marc Blaise | last post by:
Dear all, I have simulated the windows MULTI application with a java program calling the SQLTP1DL proc referenced as DB2DARI application, on Linux Intel or ZLinux. If the proc is NOT FENCED,...
2
by: Dmitri Shvetsov | last post by:
Hi, Is it possible to adjust a column width of a datagrid column in a WinApp? I know how to do that in a WebApp, but a WinApp is still a problem for me. Do we have this method/property to...
1
by: Ivan Sammut | last post by:
Hi, I have just started using c# and this might be a stupid question. I have 2 Forms (Form1 & Form2). I want to create a procedure in Form2 which I can call from Form1 but I cannot find a way to...
5
by: Stan Sainte-Rose | last post by:
Hi, How can I call an event from an action. Example, I want to call the datagrid.Double.click event when a button is pressed. Stan.
1
by: John | last post by:
What is the difference between using a Word/Excel Project via Office Tools in Visual Studio versus using a standard WinApp Project and setting a reference to Word or Excel? Specifically are...
2
by: savio XCIX | last post by:
I created the following stored procedure: ======= CREATE PROCEDURE TBLNAME.proc_test (IN p_custnum VARCHAR(8), IN p_zipcode...
0
nev
by: nev | last post by:
I know when is best to use some templates but listed below are most that I don't know when is best to use or even know how to use: I am creating a windows application with mysql backend. 1....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.