.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

What happens (threadwise) when I call Form.Show()?

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :Windows Application


I'm doing a dll an object of which will be created by a COM host.

I've done all the interop stuff but now I want to display a Form and when someone presses a button of that form, I'll call host methods.

So the setup is this:

Com-Host executes VBScript

VBScript says set X = createobject("MyStuff")

And then X.check(HostObject) . X is implemented in C#. HostObject is the COM Host, a CAD tool.

So far so good.

In check(ViewDraw.IvdApplication App) I do a

MyForm G=new MyForm(App); G.Show();

What happens is that Show() returns immediately, I'm quickly back in VBScript but the form stays on the screen and is plainly usable.

On the other hand, if I display the thread id's while executing in

  • check()
  • MyForm->Menu-Exit

I always get the same thread id.

So, how does that work?

If I store App as a property of the form and, upon some buttonpress event, call methods like App.GetAllSchematicPages(), they'll still hit App out of the blue. Is that safe? The CAD program itself is definitely not thread safe.

Would I have to do some kind of producer-consumer queue for processing messages in the check(App) method?

I'm picturin something like:

More Related Resource Links

How to show previouse user comments on the task form of a user in sharepoint Designer

I am using sharepoint designer for designing workflow. I have 4 steps. on each step a user write some comments for the next user. now I want to show all those comments on task form for the current user to whom the task has been assigned.

Unable to Show Edit item Links in Data Form Web Part

I have a DFWP connected to custom list and the boxes to Show Edit Item Links, Show Delete item links and Show Insert Item links are grayed out so that they can not be checked. This works fine when I use a DFWP connected to a standard list (i.e., Contacts). Is there something special that needs to be done to activate this functionality?ThanksDean

how do I create/show modal form using the following code?

The text contained in a .txt file loaded with the following code doesn't show up in the RichTextBox control on a separate form which has been instantiated and launches sucessfully.  Why don't the contents of the .txt file show up in the RichTextBoxControl on the instantiated form?  Thank you for ideas! private void ToolStripMenuItemOpenAlarmHistory_Click(object sender, EventArgs e) { OpenFileDialog openFile1 = new OpenFileDialog(); FormAlarmHistory_Loaded_Into_RichTextBox formAlarmHistory; openFile1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; if(openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && openFile1.FileName.Length > 0) { using (formAlarmHistory = new FormAlarmHistoryLoadedIntoRichtTextBox()) { dialogResult = formAlarmHistory.ShowDialog(); if (dialogResult == DialogResult.OK) { formAlarmHistory.richTextBoxPrintCtrlForLoadedAlarmHistory.LoadFile(openFile1.FileName); } } } }

Mdi Form Locks Up When Trying To Show Form from Added Project

I added a second project to my solution, and now I am trying to load a form from the added project as a child to the Mdi which is in my first project.  Everything looks okay, but the Mdi locks up when I click on my toolStripMenuItem.  There are no error messages and it builds okay.  I am using VS2010. using PDFToImage; private void pDFToImageToolStripMenuItem_Click(object sender, EventArgs e) { PDFToImage.FormMain FormMain = new PDFToImage.FormMain(); FormMain.MdiParent = this; FormMain.Show(); } Rob Evans

Show form in browser?

Hi all. I am working on MOSS 2007 Enterprise platform. I am using InfoPath, and have checked on "Design a form template that can be opened in a browser or InfoPath", and also edited the settings of my Document Library to display browser enabled documents as "Display as a Web page".  The template is saved as a content type. When I go to my library, I can chose to create a new document with my InfoPath template, and it will open in a web site. I don't want it to behave like this. I want my form to be shown on a page, within the masterpage, where the users can register information and submit by clicking on a button. Can this be done? Are there any web parts to accomplish this? Regards

How can I show version history on a custom edit form?



I have a simple list that contains aa title and a number field.  On the edit form, I want to show all prior updates to the number field, like so:

Title:  ABC
01/01/2010     10  Updated by: user1
02/01/2010     20  Updated by: user2
Count:            <Textbox for input>

I can create a custom edit form in Designer, but by default I get a DataFormWebPart with an XSLT.  I don't know how to configure the data source to pull all versions so that they could be shown in the XSLT.  If I can't use the DFWP and have to do everything custom, please provide details and/or links.

This is for WSS 3.0.  Any help would be greatly appreciated.  Thanks!
 - Ed.

Show workflow status in form?



I am trying to show the workflow stat in my form by using a recieve data connection. The only thing I get shown in my field is 0, no matter what.

Is it possible to show Approval staten, i.e. "Pending", "Draft", "Rejected", "Approved" in a read only in a read only field in my form?

show only infopath form created by me after approval

hi, i have a form that can be filled by a user and approve by a approver. but what i notice is when the approver approve or reject the form and submit it to the user his library it shows that it is created by the approver and not the user that has filled the form. i want that the user can view only his form that has been send back. how can i do this. i can not use "created by [ME]" because the created by me has the name of the approver. does someone knows how to do this?

how to make VS Intellisense show complex object's properties for result of Ajax call?



I've create a WCF webservice and created a proxy to the service using ScriptManager.

I can see the created a proxy class, and intellisense pops up the methods of the webservice (great!!). But, I can't see the properties of the method params, return types.

The webservice method:

searchResponse DBSearch.Search(searchRequest)

have comlex types as a parameter (searchRequest) and a return type (searchResponse).

Intellisense does recognize these types, but I can not see the properties (javacript does);


var _searchRequest = new DBSearch.SearchRequest; (intellisense knows type SearchRequest)

_searchRequest.query = "liver lacerations"; (intellisense doesn't know it's property 'query')

_searchRequest.searchOptions = "modality=mri";

Obviously, with javascript, var _searchRequest is not typed, but is there a way to hint intellisense into the properties of the class?



how to call a webservice upon opening form from library?



I have infopath forms in sharepoint library. When i open a submitted form, i want to call a webservice, how can i go about to achieve that?

What i have done so far is:

1. set a rule on a certain field

2. call the web service when that field gets populated

3. however, webservice is not called because my web service will output into a log file, but there's no output

Null values doesnot show up in custom edit form in a drop down choice menu


Hello guys,

I have a problem. I don't know why custom edit form is behaving like that.

I have a choice drop down with values  " ","Yes","No". For custom  new form, I can insert null values and everything is working fine.

But coming to this custom edit form which I created.  While editing, if we set a value to null and submit the form. It is getting the "Yes" as the value. It is skipping the null value and placing the "Yes" value. I have kept the default value for choice drop down as " ".(null too).

I don't know why it is not showing null value. Do guys have any idea or if came across anything like this. Please help

How to run/call .rdl report from VB.net form?

I am beginner in vb.net, I have created a report (report001.rdl) in SQL Server Report Builder 3.0 and I want to call/run this report from vb.net form. 

Please tell me how can I do this, if you have any sample code..

How to show popup model form thru code behind?


How to show popup model form thru code behind?

Actuly i have a button in my master page and my multiple

forms are inharit from that, so OnClick of master page button

my inharit form event get executed, so how can i open the form

as model form thru code behind as well if user click ok button of

model form then i wanted to refresh the page.

i am not using ajax toolkit, so i can't use <ajaxToolkit:ModalPopupExtender>.

Workflow Initialize Form Can Show In Manual Mode Only?


Hi friends,

I have a Sharepoint Workflow Initialize Form, I'd like it to show when an item is created on the list, and I'm sure I've selected this option in workflow association, but that Initialize Form doesn't show up when item is created. But it can show when I manually start a workflow instance.

So workflow initialize form can show in manual workflow start only?


EaTing Shan

Workflow Initialize Form Can Show In Manual Mode Only?


Hi friends,

I have a Sharepoint Workflow Initialize Form, I'd like it to show when an item is created on the list, and I'm sure I've selected this option in workflow association, but that Initialize Form doesn't show up when item is created. But it can show when I manually start a workflow instance.

So workflow initialize form can show in manual workflow start only?


EaTing Shan

Show wait form while loading another heavy form


Dear All,

I have a situation in my project that is a small and nice popup with loading animated gif should show while loading heavy forms in the application. For that to implement I have used threading concept. I am opening loading splash form in a separate thread and ending it when the main thread notifies that its task is completed. Every thing is working fine but my problem is when the user clicks on the application's forms while splash screen is doing its business the application is hanging.

Please help me on this.The code is as follows

class PleaseWait : IDisposable
        private FrmSplashWait mSplash;
        private Point mLocation;
        private string ttlTxt;

        public PleaseWait(Point location,string ttl)
            mLocation = location;
            ttlTxt = ttl;
            Thread popupthread= new Thread(new ThreadStart(workerThread));

Model form open but page content is not show how to solve


i am  loading a page when we click a button .i am require a loadimage.show when i div laoding time and disapper when i div loaded but model form content is not show

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"></script>

    <a class="ajax" href="http://www.google.com">
      Open as dialog

    <script type="text/javascript">
    $(function (){
        $('a.ajax').click(function() {
            var url = this.href;
            var dialog = $('<div style="display:hidden"></div>').appendTo('body');
            // load remote content
                function (responseText, textStatus, XMLHttpRequest) {
            //prevent the browser to follow the link
            return false;

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend