Hello,
C# !!!
How can i back from Application.Run to place where was is called?
or, what should i do, when i must to use Application.Run( new MyMainForm() ) to run my application?
so i can´t use this way:
MyMainForm myForm = new MyMainForm();
myForm.ShowDialog();
Thanks
10 1863
So make a dummy Form that does the .ShowDialog() code and never actually shows itself.?
I need the GUI, that i started, to test it with NUnitforms...
so...
How can i back from Application.Run to place where was is called? (to test it with NUnitforms)
or, what should i do, when i must to use Application.Run( new MyMainForm() ) to run my application?
so i can´t use this way:
MyMainForm myForm = new MyMainForm();
myForm.ShowDialog();
because my application use Backgroundworker.
I tried it like this, but i couldn't debug it:
.....
ApplicationTestStart _applicationTestStart = new ApplicationTestStart();
ThreadStart ts = new ThreadStart(_applicationTestStart.Run);
Thread t1 = new Thread(ts);
t1.Start();
--------------------------------------------------------------------------------
public class ApplicationTestStart
{
public ApplicationTestStart()
{
}
public void Run()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new MyApplicationContext(new string[] {}));
}
}
Thanks
What are you trying to do? The structure isn't too clear.
You can do this, if it helps: -
TestForm tm = new TestForm;
-
Application.Run(tm);
-
Just for example:
[PHP]
public class ProgramTEST
{
public ProgramTEST()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new MyApplicationContext(new string[] {})); // -->This bolcks the course of the application.
}
public ControlTester buttonTester;
public void Test()
{
buttonTester = new ControlTester("_okButton", "myForm");
buttonTester.FireEvent("Click");
}
}[/PHP]
I don't know what's going on in your Test() function, but the rest looks fine?
It is just example, a GUI will opened and than will clicked on OK button automatically
So why not have the code that "clicks" the button automatically happen in the gui, like in the form_load() event handler?
I cannot change anything on the GUI Software, It is Just example, that i click on this button, the problem is:
On this following line, my program stops:.
Application.Run(new MyApplicationContext(new string[] {}));
or, when you write:
ProgramTEST MyTest = new ProgramTEST(); // here my program stops, tell i close the GUI!!!But i need the GUI!
MyTest.Test();
HAve you tried making a new thread?
I started my GUI in Thread, but i cannot debug it! -
public ProgramTEST()
-
{
-
ApplicationTestStart _applicationTestStart = new ApplicationTestStart();
-
ThreadStart ts2 = new ThreadStart(_applicationTestStart.Run);
-
Thread t1 = new Thread(ts2);
-
t1.Start();
-
}
-------------------------------------------------------------------------- - public ApplicationTestStart()
-
{
-
}
-
public void Run()
-
{
-
Application.EnableVisualStyles();
-
Application.SetCompatibleTextRenderingDefault(false);
-
Application.Run(new BootApplicationContext(new string[] { }));
-
}
-
do you know, how i can use "BeginInvoke" make it work?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steven Bethard |
last post by:
I feel like this has probably been answered before, but I couldn't
find something quite like it in the archives. Feel free to point me
somewhere if you know where this has already been answered.
...
|
by: Lian |
last post by:
Hi all,
It is a newbie's question about html tag "img".
The attributes "title" and "alt" for "img" seems having the same
function. So what is the main difference between them?
Can i use them at...
|
by: Patrick |
last post by:
I'm writing a winforms database application in C#. I've come across a lot of
stuff lately about "N-Tier" architecture.
Can anyone give me a simple explanation of N-Tier? The descriptions that...
|
by: MuZZy |
last post by:
Hi,
Lately i've been (and still am) fixing some memory leaks problems in the project i just took over
when i got this new job. Among the other issues i've noticed that for localy created objects...
|
by: charliewest |
last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list
to a ComboBox control using the "DataSource" property. I have set the
DisplaySource and ValueMember properties as well....
|
by: Flare |
last post by:
Hi
I just read and experimented with normal .net GUI apps and deployed them
with notouch deployment strategie as smartclients.
Is it just me, or i this an very neglected topic?
For me it...
|
by: relient |
last post by:
Question: Why can't you access a private inherited field from a base
class in a derived class? I have a *theory* of how this works, of
which, I'm not completely sure of but makes logical sense to...
|
by: DJ Tuneman |
last post by:
I've noticed that if I enable the "Application Framework" in the project for
a Windows app, there's a bug when the programs load and I didn't even notice
it until lately.
If you click the "Show...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
" I saw your report " Tom Cruise " I liked it Look at this one if you
will..." Inbox
U S Contractors Offering Service A Non-profit
More options 3:50 pm (9 minutes ago)
" I saw your report "...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
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...
| |