|
We've already been through this - you're screwing up the application's message pump. One common way is when controls are added to another control in a separate thread. You never did respond to me if you were doing that.
All controls MUST be added and - in most cases - modified (such as adding ListViewItem s to a ListView ) in the main UI thread (the thread that started the application). This is documented in the .NET framework. If you need to add a control in a separate thread, you have to do so by invoking the control method. See Control.InvokeRequired and Control.Invoke for more information.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ah, I thought it might be related.
Okay well, I'm not using any extra threads or anything.
Here's the sequence of events
1) User clicks on an item on a tree view, on one side of a splitter
2) Program responds to the tree selection event by creating a rich view and putting it in the right side of the splitter (by adding it to a panel's Controls.
3) User types stuff in that rich view, then selects a differerent tree node from the left view.
4) Program responds to the tree selection event by calling Panel.Remove on the rich view, and adding a different (new) one.
After step number 4, the program is no longer responding to quit commands. Could it be possible that Tree Events happen in another thread? It doesnt seem possible.
|
|
|
|
|
I did manage to 'avoid' the problem by never calling remove on the panel, but instead calling Dispose on the rich view WITHOUT removing it from the panel. (Perhaps it removes itself).
Calling Remove without ever calling dispose still causes the problem.
However, that seems messy.
It only seems to happen if the rich view has focus when it is removed. I've currently made it so that when the tree gets a 'left mouse down' event, it immediately forces focus away from the rich view BEFORE it removes it (in response to the 'tree item changed' message, which comes after the mouse down event), and that works fine... it just seems an evil hacky way to do it.
Perhaps theres some rule about not calling Remove on a control which has focus.
|
|
|
|
|
Probably is some rule about that. Keep in mind, too, that pretty much everything in System.Windows.Forms is a wrapper for the respective common control, so everything still comes down to messages (sorry if I said that before). Messages can be finicky little stinkers at times. I've also noticed that some things aren't always wrapped the best, IMHO. If you care to poke around in the PSDK, you might find more information about destroying controls that have captured the focus.
Disposing is definitely a good idea anyway. It helps free up memory quicker.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Just wondering if someone could point me in the right direciton. What I am looking to achieve is to be able to dynamically load a class from an assembly at runtime, to achieve what use to be done using a ProgID/GUID to access a COM object. If someonce could give me a quick overview of the techniques that I should be looking at, that would be great.
Cheers
AJ
|
|
|
|
|
Check out the Activator class. I use Activator.CreateInstanceFrom in some of my code. It seems to work really well.
TF
Tim Friesen
tntfriesen1@hotmail.com
|
|
|
|
|
Extending on what Tim said, the Type is unique to each class, enum, delegate, or struct in an assembly. It contains the namespace and class name, the assembly which contains the type, and a few other pieces of information (including version, culture, and public key token (if signed - which it should be for better applications and versioning control)). This takes the place of GUIDs and ProgIDs.
Besides Activator.CreateInstance , you can have more control over type loading by using the static method Type.GetType . For instance, say in your application's .config file (yourapp.exe.config, which takes the place of the registry which you're not supposed to use in .NET unless necessary) you have a partial type string like "MyNamespace.MyType, MyFirstAssembly" (version information and other stuff can be left out as long as the CLR can resolve "MyFirstAssembly"). If you want to get the type before instantiating it, you can read the value out of the configuration file and call Type.GetType("MyNamespace.MyType, MyFirstAssembly") . That returns a Type which you can use to create an instance of use Reflection to get other information (such as whether or not it implements a particular plug-in interface you require before instantiating, although you could get this by using the is keyword after instantiating, but perhaps instantiating it is pointless to you if it doesn't implement a particular interface).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
My VS.NET installation is really annoying me. I'm using VS.NET 2003 Enterprise Developer and we have created a solution with approx. 30 projects.
VS.NET rebuilds everything every time I select to either build or run the solution - it doesn't matter if I have just changed a single line or added a new project, it always rebuilds everything.
In addition, if I choose build and then run it rebuilds everything two times - one when I choose build and one when I choose run.
Any ideas why VS.NET might be doing this? And better yet - any ideas on how to solve this issue?
Thanks for your help, Mads
|
|
|
|
|
I don't know if this is the answer to your problem but I remember having a similar problem in VS years ago.
It was due to one of the source files having the datestamp set in the future. So VS would look at the times on the source files and on the dll/exe files produced and concluded that since a source file was apparently modified after the exe/dll was produced that it must rebuild it. If that source file is in a project that all others are dependant on then everything will get rebuilt.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
This is actually the way it is supposed to work. From the main menu, the build commands work on every project in the solution. In release builds, any slight change causes the whole thing to recompile because incremental builds are disabled by default.
Here's a tip (I have about 50 projects in my solution, so I do this all the time): Right-click on the project you really want to build and select Build, Rebuild (cleans and builds), or Debug->Start new instance. This will only build the dependencies based on the file modification dates of those projects.
Another tip: To each project that has dependencies on other projects, when you click Add Reference switch to the Projects tab and select the project there. This ensures a proper dependency chain no matter which build configuration your in (Debug, Release, or a custom configuration). This also helps VS.NET resolve which dependencies should be build when you use the first tip above.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Great tip - many thanks, not so annoyed with VS.NET anymore
Mads
|
|
|
|
|
Go to the build project, Configuration Manager option. Unmark the projects that you don't want to build.
Mauricio Ritter - Brazil
Sonorking now: 100.13560 MRitter
English is not my native language so, if you find any spelling erros in my posts, please let me know.
|
|
|
|
|
If I do that, the unmarked projects will never be included in the build (not even if they are changed).
Mads
|
|
|
|
|
I’m working as a programmer and make up my living by writing C++ apps with MFC in MS Visual Studio .NET. I have read none about C# but would like to learn it if it could make my day better.
Which are the arguments of changing language??
Pleased for all comments.
and justice for all......
- APe
|
|
|
|
|
If you are doing business applications then C# is better suited. It has easier access to databases, generating web pages, web services and so on. C++ can do these things but it takes more work.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
Note that the two things aren't the same, though. MFC requires one DLL (MFCXX.DLL) to run and uses native DLLs for everything else. C++ just requires whatever DLLs you're calling entry points into.
C# is a managed languages that targets the Common Language Runtime (CLR) and is one of many languages for the .NET Framework which - like the Java Runtime Environment (JRE) - is required to run applications written in that language.
Also, C# - and all languages targeting the CLR - compile to MSIL (Microsoft Intermediate Language, an extension to the standard Intermediate Language), which gets Just-in-time compiled (JIT'd, it can also be ngen'd to pre-JIT an assembly in the Global Assembly Cache) and executed.
So, if you build applications for .NET, the .NET Framework must be installed. Take this as a drawback or bonus. It's called managed code because the CLR manages all memory and bounds-checking.
The best thing you could do to evaluate .NET is to read the .NET Framework SDK documentation which - if you did a full install on the VS.NET studio - is in your help. There's many articles talking about the differences, the class library, and lots of other topics. Like everything, the only way to truly learn (and develop, vs. just writing code) is to read and try it out.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks guys. I’ve noticed I should read the .NET Framework SDK documentation before publishing my question. But it certainly will be more questions later on.
APe
|
|
|
|
|
Hello,
I am trying to create a custom web-service and have it running in the web
server
where the SPS 2003 is installed.It needs to be there cause it wraps
SharePoint DLL's .
However if I put it under
C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\60\TEMPLATE\LAYOUTS\
or
_layouts virtual directory in IIS
I get an error that says :
No http handler was found for request type 'GET'
If I put it in C:\Program Files\Common Files\Microsoft Shared\web server
extensions\60\ISAPI
where the rest of the builtin .asmx files are, then I can't open the
solution from VS.NET at all,
nor can I reference it from another webapplication.
Any suggestions ?
thank you in advance.
Pilgrim
|
|
|
|
|
You can't put a web service in a non-public directory. First, IIS (IUSR_COMPUTERNAME) and ASP.NET (ASPNET) have to be able to access the directory. Second, the directory can't be blocked for access (like the bin directory). Basically, your .asmx file has to go into a publicly-accessible directory and the logic for that file goes into the "bin" subdirectory of your Web Application - just like all other assemblies in ASP.NET. That's where the CLR looks for assemblies (by default) when it loads types.
If the assembly behind the .asmx file needs to access SharePoint DLLs, then make sure those DLLs are in the %PATH% environment variable (i.e., add the directory where those DLLs to your system %PATH% using the Advanced tab of the System control panel).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Does anyone know if its possible or even a good idea to distribute MSDE with your C# applications ??
Any articles ?
|
|
|
|
|
Yes you can. See http://www.microsoft.com/sql/msde/[^] for more information. Basically, if you obtained MSDE through Office Developer, Visual Studio, or several other products, you can redistribute it. The link above and the readme files in the distribution discuss ways of redistributing it using the Windows Installer merge modules, or to bootstrap your application to install an MSI (there are 18 - each one corresponding to one of the 18 instances that can run simultaneously so make upgrading your application easier (just keep using the same named file with each new version of the MSDE).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I am trying to use the "New Project Dialog Box" into my Application .I want it to work like the way it works in VS 7 i.e. when i click the file menu New >New Project i want the New Project Dialog Box to open up.
But the Kinds of Projects /Templates (which i inted to develop later) will be different or specific/modified to the application that i am developing.
Can somebody please advise me/ direct me to a code snippet,so that i can use this object/compnent into my Application.
Rajn
|
|
|
|
|
You can't reuse that dialog because it's in a separate application, so just create your own form and add all the logic yourself. VS.NET searches certain directories for wizard files, reads the information from those and builds a list. Just do the same thing. It's not like it'd be hard to create a similar form for your application.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank You Stewart,I'll follow your guidelines.If i have any problems doing it i'll post the questions on the forum.
Thank You again
Rajnp
|
|
|
|
|
Hello
í want to fill out a html formular on a html webpage using c#
i use a normal webbrowser component to view the site
and then i want to fill out the fields of a fomular by click a button or anything else
could someone help me?
cia buzdaman
|
|
|
|