|
|
my program use treeView control to display as active directory object browser.
it's still fine as i have one treeView control in mainform,but i have problem when i start to include treeView in another form(created from mainform like dialog).
the window almost look not responding when i refresh the second treeView control. i really need help
if you are not clear about what my problem is please let me know
really appreciate the help.
if you have active directory installed, maybe you could help examine my program.
thanks
|
|
|
|
|
|
i download the file, and it's corrupted..what should i do?
|
|
|
|
|
Both files are fine. I download them and unzipped them with no problems. Try downloading them again.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i can download the file, but when i can't unzip, the report is unknown compression.
maybe you could do me a favor send to my email vcorn8@yahoo.com
Thank you
|
|
|
|
|
Try downloading a free app that can use the .zip extension. Winzip has a free copy (bugs you after 30 days) that can work with Zip files!
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
Because of restrictions on email where I work, no, I can't.
Besides, I'd be sending you another .ZIP file, more than likely with the same compression, or I'd be sending the same .ZIP file. Do you have WinZip? Then it should work with no problems. Don't rely on the ZIP functionality built into Windows XP and above...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i have winRAR
it seems it's my internet connection, it took me a while to open codeproject site, i'd be glad if u could send to my mail.
i just wanna know whether he use threading or not.
i found sometimes the work done to active directory is very fast in my program and sometimes run very slow like not responding and i believe it has to do with GUI updating
|
|
|
|
|
Get WinZip. It's worth the trouble to download it. I can't send attachments from work to the outside Internet...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am writing a project that runs code from several assemblies.
Each assembly should be isolated, and the project supposes to be lightweight, therefore I am running one process and each assembly runs in a different AppDomain.
The project suppose that an assembly may crash or stack and uses the AppDomain.Unload() method to remove an AppDomain to release its resources.
I got to a problem once I tried to unload an AppDomain while a thread, that belonged to it, was waiting on a MessageQueue.Receive(). The AppDomain threw the CannotUnloadAppDomainException exception and didn't unload, or at least not gracefully.
The problem happens when a thread waits on a message queue and cannot be aborted, interrupted, or terminated forcefully. I didn’t try it, but I believe that the same happens when the thread waits for other things that use internally unmanaged code such as sockets.
How can I unload these AppDomains?
How can I force a thread to exit code that suppose to be managed such as MessageQueue.Receive() and Socket.Receive()?
Thanks,
Ami
|
|
|
|
|
When possible, set Thread.IsBackground to true on threads you create. See the .NET Framework SDK for more information about this property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It doesn't work, since the difference between foreground and background threads only affects the way the application exits, and not the way an AppDomain is unloaded.
MSDN: Thread.IsBackground : "A thread is either a background thread or a foreground thread. Background threads are identical to foreground threads, except that background threads do not prevent a process from terminating. Once all foreground threads belonging to a process have terminated, the common language runtime ends the process by invoking Abort on any background threads that are still alive."
What I want to do is to "kill" the AppDomain gracefully, without the need to do anything special within the AppDomain, and changing the way of threads creation is one of them.
I can't believe that I am the first person that gets to this problem. If you can’t “kill” an AppDomain then what is its advantage over a process?
|
|
|
|
|
Ami B. wrote:
I can't believe that I am the first person that gets to this problem. If you can’t “kill” an AppDomain then what is its advantage over a process?
You're probably not - try googling for others.
An AppDomain is an application boundary where assemblies are isolated from each other except through .NET Remoting and proprietary methods (sockets protocols, etc.). ASP.NET uses AppDomains so that when the Web.config file changes, an AppDomain is killed and new one respawned - all from another AppDomain started by the worker process. This allows the process to continue to run and an AppDomain to monitor the change status of the Web.config file so that it can respawn an AppDomain for the ASP.NET web site.
Executing threads must be aborted when the AppDomain needs to be unloaded. This may require changes in the assemblies you're loading, such as spawning threads for I/O, etc., or using async calls.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Very simple example of what I want to do.
I have a textbox on my form:
TextBox textBox1 = new TextBox();
I have a string containing the name of my textbox:
string strControlName = "textBox1";
I have a string that contains the text for my textbox to display:
string strControlText = "Hello World";
How do i use strControlName and strControlText to set my textbox's text property? (without looping through my controls on the form and using if statements).
In another language I know, you can use 'Indirection'. It's a very useful and powerful tool. This acts similar to the following:
set (@strControlName).Text = strControlText
where the end result is textBox1.Text = "Hello World".
I would love to be able to do this in C#! I was told to read up on reflection, but couldn't find what I wanted. Is there somehow a way to modify an existing control when all you know is the control name? (without looping through all the controls) Please help!
|
|
|
|
|
It depends - is the TextBox a field or property declared in your container (i.e., Form , UserControl , etc.) or is it simply a variable? Reflection only works on type metadata, so if it's a variable it won't work.
If it is a field, then you could do something like this:
public void SetText(string name, string text)
{
FieldInfo field = this.GetType().GetField(name);
if (field != null)
{
PropertyInfo prop = field.FieldType.GetProperty("Text");
if (prop != null && prop.CanWrite)
{
object obj = field.GetValue(this);
prop.SetValue(obj, text, null);
}
}
} This also works best when you don't specify the Name properties of controls, which isn't required (the designer does, though).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
the TextBox is an actual control that I placed on my form. Does that help?
I tried your code, but field is returned as null when I do the this.GetType().GetField(name).
|
|
|
|
|
That should be:
FieldInfo field this.GetType().GetField(name,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); This will include non-public (i.e., private or protected) members in the search as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I think I understand what you're doing here, except for the last 2 lines. I don't have the object reference for my textbox. All i have is the name of the textbox. I need to be able to get this reference and set the text property on my textbox control.
|
|
|
|
|
Kasdoffe wrote:
I think I understand what you're doing here, except for the last 2 lines
Nevermind, I'm dumb
Anyways I got it to work like you showed except I had to add BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public as the second parameter to the GetField() method.
Thanks for your help! This is awesome!
|
|
|
|
|
I am not looking to create, rather I am more looking for advice on something to buy.
I would like to be able to scan in paper forms and use a tool to convert the image into a form that C# can use.
If such a tool does not exist, can you point me towards a tool that would build HTML or other interface from a paper form.
thanks
|
|
|
|
|
Anonymous wrote:
convert the image into a form that C# can use.
What do you mean by "use"? What do you want to do with the information off of the form? Are we talking about filling in items on a Windows Form or are you trying to do Windows Form layout?
I'm assuming layout since you mentioned
Anonymous wrote:
If such a tool does not exist, can you point me towards a tool that would build HTML or other interface from a paper form.
I've never heard of such a tool. And, frankly, can't image how something like this would even work considering the complexities of an HTML form that just can't be described by an image on a piece of paper.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When I select some text in a RichTextBox, the control draws a filled blue rectangle around the selected characters. It appears that .NET doesn't allow this color to be changed. Is there a way to do this through either .NET calls or P/Invoke?
#include "witty_sig.h"
|
|
|
|
|
Take a look at the RichTextBox.SelectionColor property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That changes the color of the selected text, not the selection rectangle drawn by the control.
Is there a way to change the color used to highlight the text (i.e. the blue rectangle drawn over the selected text)?
#include "witty_sig.h"
|
|
|
|