473,387 Members | 1,463 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.

execute public sub on other form

i have 2 forms:

form1 with 1 button

Dim f As New Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

f.Show()

End Sub

Public Sub sven()

MsgBox("dd")

End Sub

form2 with 1 button

Dim f As Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

f.sven()

Me.Hide()

End Sub

Why does this not work? how can I execute sven by clicking button1 on form2?
Nov 20 '05 #1
2 1096
* "Sven" <f> scripsit:
i have 2 forms:

form1 with 1 button

Dim f As New Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

f.Show()

End Sub

Public Sub sven()

MsgBox("dd")

End Sub


Add a public property of type 'Form1' to Form2 and pass a reference to
your instance of 'Form1' to 'Form2' by setting this property to 'Me' in
'Form1'. Then you can access the instance of 'Form1' from 'Form2'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

7
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with Server.Execute? Specifically for me it simply is not executing ... the server does not transfer to the page specified. The calling ASP just...
15
by: Madhanmohan S | last post by:
Hi All, I want to run a command line appplication from C#. When i start the application, it will go into specific mode. After that, i have to give commands to use the application. How Can This Be...
2
by: roni | last post by:
hi. i have applcation in net. in that application i have 3 threads. 1- main thread with message loop and form 2. thread with message loop and form 3. thread with message loop and form ...
4
by: Erik | last post by:
First, I am not creating any new threads via invoke or any other intentional means. As far as I know, there is just one thread, which is the main thread. My windows form class creates a new...
0
by: oliver | last post by:
QUESTION: How to access an object embedded in a UserControl through Javascript file? Another way to ask this question: How to execute script from a UserControl, accessing other objects in that...
4
by: Mike TI | last post by:
April 22, 2006 Hi all I want to execute a command stored in a variable, eg I may store: Form1.Show() or Form2.Show()
9
by: Pachydermitis | last post by:
Hi, Is there any way to execute a function by using it's pointer? The reason I want to do this is: I have a control on a form that I have wrapped with a class. I want to be able to dynamically...
7
by: Jeff | last post by:
I need a way to do the following and cannot seem to find a solution via google. 1. Have a method from the main app to get all open forms 2. Check each open form for a public method 3. If this...
5
econVictim
by: econVictim | last post by:
hey guys, i'm new to working with .net c#. I've been doing some more advanced things without knowing much about what i'm doing... I need to create this popup window without using the javascript.....
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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.