Why can't I call a public function or sub defined in the main form of my
application from within a module or a class, all being a part of the
same assembly?
When I define public function in a class, I can call it from the form,
but if I define public function in the form and try to call it from the
class it does not work. Any idea what am I doing wrong?
Thanks,
Strah
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05
15 9605
Strah,
Looking at Herfrieds sample, I saw I misunderstood your question completly
wrong.
Sorry
Cor
Chris,
I am not sure, however seeing Herfrieds answer (I did not open it, normally
I know them) than we both have interpretted Strahs answer wrong, so forget
my message. And when you had interpretted it right, than forget this as
well.
:-)
Cor
"Cor Ligthert" <no************ @planet.nl> schrieb: The answer is in my opinion very simple the goal is to make classes independent from each other.
Communication (passing data) between classes will always make them "depend"
on each other, independent from the fact that in this case we are dealing
with forms. It's good to reduce dependencies, but I don't undetstand why my
solution is considered "bad" -- there are solutions that are worse than the
one described in my article.
Just my 2 Euro cents...
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Herfried,
I appreciate everybody's input as this helps me (or anyone else
involved) to learn a thing or two. However this time, your solution was
only that really helped me out and that I applied with a great success!
... so, to me, it was like much more the 2 Euro cents,... more like a 2
thousand Euros :)
Thanks again ... and I agree about your comment concerning dependencies.
A form is just another class and it should behave (at least as far as
functions sharing) as any other 'regular' class. As long as one class
call for another they are dependent, whether they are forms or not. With
the clever use of constants, one should not ever have big time problems
changing names of the class and its name in the code accordingly.
regards,
Strah
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Herfried,
I have said sorry for my misunderstandin g of the problem from Strah more
than an hour ago before you have sent this message.
I made that as well too Chriss.
What you want me to do, go to Wien to show you that and kneel at your feets?
Cor
Cor,
"Cor Ligthert" <no************ @planet.nl> schrieb: I have said sorry for my misunderstandin g of the problem from Strah more than an hour ago before you have sent this message.
OK, it seems that I missed that message for some reason :-(.
What you want me to do, go to Wien to show you that and kneel at your feets?
Definitely no. Nevertheless, if you plan to come to Vienna, feel free to
contact me.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Liu |
last post by:
Hi, I want to get the name of the calling function of an executing function,
I use the StackTrace class to do this and it seems working. However, does
anyone think that there any side effect towards this approach such as how
would it works in multi-thread.
Thanks
Tony
|
by: Gary Miller |
last post by:
Does anyone know how to detect a modeless form on closing by the form that
invoked the modeless form?
form.Show();
|
by: mark |
last post by:
I am developing an application in .Net C# that needs to restore a
number of tool windows to some previous location and size. The problem
I have is that when I create the form and set the Location and Size
properties before calling the Show method, the form is not created in
the Location that I set. If I call Show first everything works fine but
there is excesive flicker when the Location and Size properties are
set.
I tried calling...
|
by: Amjad |
last post by:
Hi,
I want to make a project that calls and executes a function (VB code) made
in a seperate file in the Application Folder. I know I can create the
function in my project and call it internally, but I want to put the
function's code in an external file, so that future updates to the function
will require a replacing the function file instead of re-installing the whole
project.
Can you give me ideas on how I can make small updates to my...
|
by: Ron |
last post by:
Greetings,
I am trying to understand the rational for Raising Events
instead of just calling a sub. Could someone explain the
difference between the following 2 scenarios? Why would I
want to raise an event instead of just calling the sub?
Scenario1 -- Using Events
------------------------------------------------------
Public Class Form1
| |
by: Christian Wilhelm |
last post by:
Hi!
I'm trying to call a Java WebService out of a .net Client. There are two
Methods, one Method requires one Parameter of type Parameter, the other
Method requires one Parameter of type Parameter.
I can call the first Method without Problems, the Parameter can be
deserialized by the WebService.
But if I want to call the second Method and give it an Array of Parameters,
then the following exception is thrown by the WebService:...
|
by: Macca |
last post by:
Hi,
I have a windows form project. The form class has a number of methods in it
that i want to call from another class I have just created.
This class is a finite state machine and is created and kicked off in same
method where the applications' Run method is called. i.e main method in
Program.cs.
I'd appreciate suggesstions for calling methods in the form class from this
|
by: Stephen Plotnick |
last post by:
I'm very new to VB.NET, or any VB.
I need to have form1 call form2 which calls form3, etc.
I am able to use oledb in form1 to get the data.
I build all the data for form2 and form3 from form1
I can call form2 from form1 without any probles, all the data is there. I
can change to call to form2 to form3 and all the data is there and I can see
|
by: Bugs |
last post by:
Hi,
I wonder if anyone can help me out.
I'm building a vb.net application that has a form with a panel that
contains several other sub forms (as a collection of controls). What
I'm wanting to do is call a generically named public sub in the
top-most sub form in the panel.
I have the name of the top-most form as a string (eg. g_TopForm =
"frmCustomers") and I can reference the form with:
|
by: SAL |
last post by:
Hello,
I'm developing this remoting app (.net 2.0) and I need to bring the server
app's form to the front often. Since you can not do cross-thread
communication on a form or control without using Invoke, I declared a
delegate to handle the cross-thread call to bring the form forward. Here's
my code:
Delegate Sub BringMeFront()
Public myDelBringFormFront As BringMeFront
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |