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

InvokeOnClick Method in VS2005

I have a main form frmMain containing a button button1

I have another form frmNew containing a textbox txtBox1 and a button button2.

I have the following code behind the button button2 in frmNew:
Messagebox.Show(txtBox2.Text.tostring());

I have the following code behind the button button1 in frmMain:
frmMain frm = new frmNew();
Button btn = frm.button2;
this.InvokeOnClick(btn, EventArgs.Empty);

When application is launched; both forms a re displayed on the screen. I
entered a "My Text Message" in the frmNew's textbox txtBox1 and then went to
frmMain and clicked the button button1 which invoked the click event on
frmNext to display the message box

The code above displays the messagebox but it is blank; it should display
"John Doe" but doesn't. Please help!!!
Aug 12 '08 #1
1 1573


RickSean wrote:
I have a main form frmMain containing a button button1

I have another form frmNew containing a textbox txtBox1 and a button button2.

I have the following code behind the button button2 in frmNew:
Messagebox.Show(txtBox2.Text.tostring());

I have the following code behind the button button1 in frmMain:
frmMain frm = new frmNew();
Button btn = frm.button2;
this.InvokeOnClick(btn, EventArgs.Empty);

When application is launched; both forms a re displayed on the screen. I
entered a "My Text Message" in the frmNew's textbox txtBox1 and then went to
frmMain and clicked the button button1 which invoked the click event on
frmNext to display the message box

The code above displays the messagebox but it is blank; it should display
"John Doe" but doesn't. Please help!!!
The documentation on InvokeOnClick seems pretty scarce, but it's
rather telling that it's not a static method. I would not be surprised
if you'd have to call it either on the control itself (though then
it's not clear why you have to pass "toInvoke" argument, which would
be the same thing), on its container, or on the form which contains
it.
Aug 13 '08 #2

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

Similar topics

8
by: almurph | last post by:
Hi everyone, I have a simple method inside a class in a solution. When I create an object from the class I see the method signature appear in the drop down - I'm sure you know what I mean. My...
9
by: David Thielen | last post by:
Hi; Is there a way to have a method called when my ASP (2.0) app is first loaded, before any pages are loaded? -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com
11
by: cindy | last post by:
I have a form, has javascript registered so a modal pops up. Button click will close form. Now I need to do an update with modal form data before it closes. I can put a second button and register...
1
by: Scott F K Hooper | last post by:
VB.NET 2.0 project... I have an Access database with a table that has one primary key. I have used the Add TableAdapter wizard in VS2005 to create my TableAdapter. Next I added an ObjectDataSource...
4
by: cok | last post by:
Hi, all I have a question about VS 2005 IDE, I donn't know if It is place to post my question,sorry I have a class inherit form System.Windows.Forms.Form, I want to override OnPaint method ,...
13
by: Ben Voigt | last post by:
Is there any way to have an overridden method which is not callable from the assembly overridding it? A contrived example (though I want this feature, my program has nothing to do with food...
2
by: David++ | last post by:
Hello list, I have built a project in VS2005 which includes a Web Service Web Site. On this server there is a Database. I have used the DataSet designer to link to this database and VS2005 has...
0
by: =?Utf-8?B?Um9iIEM=?= | last post by:
I have an application written in VC++ using MFC that calls into web service written in C#. I am developing in VS2005. I am debugging my C++ app while I have attached my Webservice project to the...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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
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,...

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.