473,779 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make a "Modal Object" ?


How can I make a "ModalObjec t" that will react like a ModalForm ? I mean an object that will run in it's own message loop and return a value (a string value) when closed.



Example :



private void SomeFunction()

{

ModalObject modalObject = new ModalObject();

If (modalObject.Ex ecute = "OK")

{

//Do some code.

}

}



Thanks For any help !!



Steph.

Nov 17 '05 #1
2 1678

Steph. schreef:
How can I make a "ModalObjec t" that will react like a ModalForm ? I mean an object that will run in it's own message loop and return a value (a string value) when closed.

Example :

private void SomeFunction()

{

ModalObject modalObject = new ModalObject();

If (modalObject.Ex ecute = "OK")

{

//Do some code.

}

}

Thanks For any help !!

Steph.

Maybe this help.
I didn't test it.

private string _returnMessage;
private bool _closing=false;

public string Execute()
{
while (!_closing)
{
//do nothing
//sleep
}

return _returnMessage;
}

private void Form1_Closing(o bject sender, CancelEventArgs e)
{
// set message
// set _closing variable to true
_closing=true;
}

Maybe you can also use the closed event.

Nov 17 '05 #2
"Steph." <st***@nomail.c om> wrote in message
news:uy******** *****@TK2MSFTNG P12.phx.gbl...
How can I make a "ModalObjec t" that will react like a ModalForm ? I mean
an object that will run in it's
own message loop and return a value (a string value) when closed.


Sounds like you're talking about a singleton...
http://www.google.com/search?sourcei...3%22+singleton
Nov 17 '05 #3

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

Similar topics

4
9803
by: Hitesh Bhatiya | last post by:
Hi all, I have written a small program to accept some socket connections, which are then added to a vector (using push_back). But after a few calls to the push_back function, it deleted the object that was added last. Could someone please tell me why this happens ? Am I doing something wrong here ?
22
3351
by: Dr Duck | last post by:
GDay all, Something seems odd to me.... I wrote a simple C# function public void bind(ref object a, ref object b, bool atob) { if(atob) b = a; else
2
13411
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class template and by setting output to a type library (DLL). All the object does is return a string value. At this point I have not checked the option to register for COM interop in Visual Studio So I go into Excel (where I want to use the object). Go to VB...
3
1500
by: muesliflakes | last post by:
I come from Java and an Object would be the class whist object would likly be the varible to an object. I get the impression with C# that object is just an alias to the Base Class Object. Can anyone enlighten me as to any differences and by convention if I had a method that returns an object should I use one over the other. public object ReturnIt( ) { return new Blah( ); }
5
2827
by: Robin Tucker | last post by:
Hiya, I'm using mshtml and the web browser control to embed an OLE object in my ..NET application. What I want to do is get a reference to the "object" embedded therein: The HTML looks something like this: <html>
14
23491
by: I_AM_DON_AND_YOU? | last post by:
Hello all: Yesterday I put this post regarding the query as to how to open a new form in "modal" style. I am calling the form in the following way: dim frm as form2() frm = new form2() frm.show
35
3232
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an instance of an object" for the line 'If mpg.FindControl("lkred").Visible = True Then'. I couldn't find sofar the solution. Any help would be appreciated ... Thanks
3
3043
by: frosted74 | last post by:
Hi, I have 2 javascript functions, one that sorts a table and one that shows/hides a modal dialog that displays something like "Sorting" with a little icon indicating that the browser is "busy" and you need to wait. This is done because on larger tables the sort routine can take upwards of 10 seconds. I try the following code: <th onclick="showModal(); sort(this); hideModal();">some header</th>
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10071
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.