473,466 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Automatically starting the C# GUI

I have a C# app that I can use in Test mode by clicking a button which
reads data from a file for my test.
I would like to start the App from the command line and run the test
automatically without
the form waiting for the button click. So I tried to call the button
click event from
frmMain() but have no information for its paramteres , object sender
and eventargs e to pass into the click event.
btnTest_Click(object sender, System.EventArgs e)

How can either fix this problem ?
Or
Is there an alternated method to do this ?

Any help is appreciated.

Mar 9 '06 #1
3 1468
On 9 Mar 2006 07:05:37 -0800, lavu wrote:
I would like to start the App from the command line and run the test
automatically without
the form waiting for the button click. So I tried to call the button
click event from
frmMain() but have no information for its paramteres , object sender
and eventargs e to pass into the click event.
btnTest_Click(object sender, System.EventArgs e)

How can either fix this problem ?


Move the code in the button's event handler to a function. Then simply call
this function from the event handler. This will allow to call this function
manually from frmMain() is you want to start the test at startup.
Mar 9 '06 #2
A better option would be to call PerformClick() on the button - however (re
your existing code) assuming that the handler doesn't do much with the args,
null and null might suffice? or this and EventArgs.Empty?

Marc

"lavu" <th******@yahoo.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
I have a C# app that I can use in Test mode by clicking a button which
reads data from a file for my test.
I would like to start the App from the command line and run the test
automatically without
the form waiting for the button click. So I tried to call the button
click event from
frmMain() but have no information for its paramteres , object sender
and eventargs e to pass into the click event.
btnTest_Click(object sender, System.EventArgs e)

How can either fix this problem ?
Or
Is there an alternated method to do this ?

Any help is appreciated.

Mar 9 '06 #3
Thank you for your suggestions. As Marc's suggestions required less
code changes, I tried it first. ( this, Empty ) as params
to button click worked. (null,null) errored out for me. Learn't
something new, the PerformClick() method.
Thanks again.

Mar 9 '06 #4

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

Similar topics

5
by: Nathan Sokalski | last post by:
I currently have Oracle 9i Personal Edition installed on my computer (I use Windows XP Professional). I want to stop Oracle from starting automatically at boot time to avoid having it take up so...
5
by: Sparrow | last post by:
I have created a table with the following columns... Date(datetime),Actual (Int),Planned (Int) I need to insert weekending dates starting from 23/04/04 looping thru'for the next 52weeks...
5
by: gregork | last post by:
I have painstakingly created an excel 2000 workbook for the very complex recipes I have to formulate. I have 2 sheets- 1 for configuring the recipe and 1 that is like an inventory of all the raw...
2
by: jmpinto | last post by:
I have a field on a form that I would like to automatically generate a number, in sequential order, each time a new record is created, and be stored in a field. The problem is that I do not want...
2
by: battery007.2005 | last post by:
hi all, i would like to know how to add a reference automatically on starting a project. i.e like we have system,system.xml automatically getting added when u start a project, similary i have a...
0
by: =?Utf-8?B?bm95ZXM=?= | last post by:
I have a solution that contains a windows forms project and some web service projects. Some of the web service projects are file-based and some are project based. When I run the application from...
2
by: Jodye Roebuck | last post by:
I have a program that's been automatically generating and sending emails flawlessly. My clients workstation had an automatic Microsoft security update done on it.. and now it's bombing on this...
0
by: s.kapitza | last post by:
Hi, try M$S servicebug 3 regards s.kapitza alghaden@alumni.fdu.edu (Ahmad) wrote in message news:<4a75f4b7.0308080649.49105373@posting.google.com>...
16
by: ayush patel | last post by:
Hi, I have tried several ways to make this work but only found work arounds. so I am posting this as a last trial. I have a windows service which has to kick start and generate a file and email...
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
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...
0
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...

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.