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

How to invoke an object method

Hi.

How can I invoke the "Text1_LostFocus()" method within the "Button1_Clik()"
method? Or wath parameters should I pass?

Thanks in advance.

Jul 21 '05 #1
4 1399

You can pass simply call it this way:

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

"FeOl" <Fe**@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
Hi.

How can I invoke the "Text1_LostFocus()" method within the
"Button1_Clik()"
method? Or wath parameters should I pass?

Thanks in advance.

Jul 21 '05 #2
I would suggest not calling event handlers directly. That is bad
programming style. Rather, you should have some methods that handle all the
functionality that you desire. Then have each even handler call those
methods as appropriate.

"gaidar" <ga****@vbstreets.ru> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...

You can pass simply call it this way:

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

"FeOl" <Fe**@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
Hi.

How can I invoke the "Text1_LostFocus()" method within the
"Button1_Clik()"
method? Or wath parameters should I pass?

Thanks in advance.


Jul 21 '05 #3
Man, what a simple solution!!! I've being looking in Help, traying to
understand Delgates, Event Handlers, etc. You save me a lot of work.

¡Thanks a lot! Regards from México.

Fernando Olvera
"gaidar" escribió:

You can pass simply call it this way:

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

"FeOl" <Fe**@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
Hi.

How can I invoke the "Text1_LostFocus()" method within the
"Button1_Clik()"
method? Or wath parameters should I pass?

Thanks in advance.


Jul 21 '05 #4
Thanks for the comment, Peter.
"Peter Rilling" escribió:
I would suggest not calling event handlers directly. That is bad
programming style. Rather, you should have some methods that handle all the
functionality that you desire. Then have each even handler call those
methods as appropriate.

"gaidar" <ga****@vbstreets.ru> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...

You can pass simply call it this way:

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

"FeOl" <Fe**@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
Hi.

How can I invoke the "Text1_LostFocus()" method within the
"Button1_Clik()"
method? Or wath parameters should I pass?

Thanks in advance.



Jul 21 '05 #5

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

Similar topics

1
by: boxim | last post by:
hi all, I'm having a few problems whereby my application is hanging when using the Invoke method of a form's control. Basically, when a user clicks a button on the form, it calls a remote...
5
by: RickDee | last post by:
Please help, anybody. I am trying to write a program so that it can launch an exe file ( which is also genereated in C# ) and then simulate the button clicking and invoke the methods inside the...
2
by: rawCoder | last post by:
Hi I am having this InvalidOperationException with message Cannot call Invoke or InvokeAsync on a control until the window handle has been created This is raised when i try to invoke a method...
3
by: Manfred Braun | last post by:
Hi All, I am able to invoke some methods from an instance of a loaded assembly, but I am not able to invoke the loaded assemblie's "Main" method. I try it this way: Assembly assembly =...
14
by: stic | last post by:
Hi, I'm in a middle of writing something like 'exception handler wraper' for a set of different methodes. The case is that I have ca. 40 methods form web servicem, with different return values...
19
by: trint | last post by:
Ok, I start my thread job: Thread t = new Thread(new ThreadStart(invoicePrintingLongRunningCodeThread)); t.IsBackground = true; t.Start(); There are lots of calls to controls and many...
7
by: stephan querengaesser | last post by:
hi ng, i try to invoke a webservice-method with an filter-object, that contains value types. if i don´t want to filter the return value of the method, i have to pass a new instance of the...
3
by: Me | last post by:
I am trying to figure out any issues with calling System.Reflection.MethodInfo.Invoke() when dealing with multiple threads. For instance.. Say I have a class that allows you to pass in a...
2
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post by:
vs2005, c# Trying to understand why one way works but the other doesnt. I have not tried to create a simpler mdi/child/showdialog app for posting purposes (I think even this would not be so small...
3
balabaster
by: balabaster | last post by:
I have a class that I want to make thread-safe and am investigating the ISyncronizeInvoke interface and wondering just what it will take to implement this interface. So far the basic concept of my...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.