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

C# showing a form from DLL

Hey,
I'm writting a programm that uses socket programming. I've put all the networking code in one Class library and use all the function like connect and sendmessage and so on from other forms. There is one form I'm having problem with it. Basically, the application recieves compule of strings form the server, writes them to a file, and then calls one form called Solution. While this form is loading, it opens the file and read lines (3 lines) and put each in one textbox. Then there a button to click that is supposed to close this form but not the application (this.hide() or this.close())
Ive tried having functions in other forms and opening the form from a form other than the DLL. I tried opening it like:
Solution S = new Solution();
S.ShowDialog();
but the problem i'm facing is, when i click on the close button in the Solution form, I get an InvalidOperationException error. The error is:
.................................................. ....
System.InvalidOperationException was unhandled
Message="The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone)."
.................................................. ....
can anyone help me with this?
Bytheway, Im using C#
Aug 14 '07 #1
2 7681
Plater
7,872 Expert 4TB
That sound like the "close" function needs to be called in the same context as the "show" function.
Like you clicking your button to "close" needs to trigger its way back to the parent who created the object and tell *IT* to close it.
That seems a little strange, but that was my take on the error message.
Aug 14 '07 #2
this must work,but the sing is you cant close or hide an open form from another form,or at least i donno how to do it. i did creat an instance and tried to close() function,but this doesnt do it.
.........
That sound like the "close" function needs to be called in the same context as the "show" function.
Like you clicking your button to "close" needs to trigger its way back to the parent who created the object and tell *IT* to close it.
That seems a little strange, but that was my take on the error message.
Aug 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
2
by: Steven C | last post by:
Hello: I have a C# app that I'm trying to build. I have three projects in the solution, the first of which stores the base object definitions (base form, base textbox, base commandbutton, etc),...
2
by: Krzysztof Karnicki | last post by:
I would like develop Form on my Windows Application, that is going to notify the user, just like Microsoft Office 2003 shows that there are new mail coming. When I use System.Windows.Forms.Form and...
2
by: Timbo | last post by:
Hi there, I’m not used to working in VB and I think this situation calls for excactly that. I use Access 97 SR-2. My first table is a table containing all the Tickets I got. The field ”Ticket”...
0
by: Brian Tkatch | last post by:
Been trying to figure out how to show borderless forms indside an MDI Form, without showing the border at all. Given that (in our case) only one such form needs to show at a time, we were able...
15
missinglinq
by: missinglinq | last post by:
I'd like to use acCmdAppMinimize with two forms on the screen at once. Currently, if I have a form opening the db (with DoCmd.Maximize in the OnLoad event) and then a popup form on top of the first...
3
by: Torben Laursen | last post by:
I have a COM shared add-in written in C# that I use in Excel. One of the thinks that the user can do is to open some winforms. The problem that I have is that the first time the user opens a...
5
by: John Dann | last post by:
Something very simple that I can't spot how to do: I wand to display a msgbox showing some current configuration parameters when my VB2005 program starts up. However, I want the main form to...
6
by: painkiller | last post by:
language: vb.net environment: windows forms .net : v1.1 i am having a checkedlistbox control that display document category such as text, image, video, audio etc. these values are coming from...
7
by: =?Utf-8?B?TWF0dA==?= | last post by:
Hi I have an app that runs without a main form, just a notification icon, when the user clicks the icon the form is shown, and when the form is minimized it's hidden. This all works great,...
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
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
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
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,...
0
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...
0
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...

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.