|
Here's a good one ...
Assembly C (.DLL) exposes (among other things) a number of type converters.
Assembly B (.DLL) exposes a derived form containing a PropertyGrid that 'uses' C's type converters.
Assembly B therefore has a static project reference to C.
Assembly A (.EXE) dynamically loads assembly B and displays B's form as a child of A's main form.
The problem is, the PropertyGrid 'loses' the type converters and the associated properties appear as greyed out text (the namespace qualified type name to be exact). I assume that internally PropertyGrid uses reflection to create C's type converter instances but C is 'invisible'.
The problem is fixed by adding a reference to C in project A but this is undesirable since C may not actually exist for a particular installation.
Loading C dynamically from A (tried both Assembly.LoadFrom and AppDomain.Load) is successful - AppDomain.GetAssemblies reports C as loaded but the PropertyGrid still falls down.
Any ideas ?
Thanks in advance
Anders
|
|
|
|
|
try to use attributes
<br />
[Designer( "UtilityLibrary.Designers.WizardFormDesigner, UtilityLibrary.Designers, Version=1.0.4.0, Culture=neutral, PublicKeyToken=fe06e967d3cf723d" )]<br />
In bold is a sumbolic name of assembly. By such name Framework can find and load needed assembly. In your case look for Convert attributes:
<br />
[ Category( "Appearance" ), <br />
DefaultValue( -1 ),<br />
Description( "GET/SET toolbar item image from Image List" ),<br />
Editor("System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor)),<br />
TypeConverter( "System.Windows.Forms.ImageIndexConverter" ) ]<br />
Such knowladge can help
Good Luck
Alex Kucherenko
|
|
|
|
|
Hi , when and how are .net attribs activated?
is it at compiletime?
if i create my own attrib and apply it to a class like this:
[MyAttrib("tjoflöjt")]
public class{
}
is the text "tjoflöjt" injected into the assembly somehow when compiling ,
or is an instance of my "MyAttrib" class created once the assembly is loaded into memmory?
attribs like "AssemblyXXX" can stop the compiler and notify the user on various things like ".snk file not found" , is it possible to do the same thing with my own attribs?
//Roger
|
|
|
|
|
|
I cann't understand how I should check for user in Active Directory.Evry time when I try to check for somethink in Active Directory thete rise this kind of exeption.
///////////////////////////////////////////////////////////////////////
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://ComputerName");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("objectClass=user");
foreach(System.DirectoryServices.SearchResult resEnt in
mySearcher.FindAll())
{
Console.WriteLine( resEnt.Path );
}
}
catch(System.Runtime.InteropServices.COMException ex)
{
Console.WriteLine(ex.Message);
}
////////////////////////////////////////////////////////////////////////////
Thank you.
|
|
|
|
|
I don't know the answer but I can point you to a resource for an example.Go to www.wrox.com and download in "Professionall C#" book.In one of its chapters there are good examples for Active Directory.Hope it helps.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://ComputerName");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("objectClass=user");
search.SearchScope=SearchScope.Subtree;//search all directory
search.PropertiesToLoad.Add("name");//add return value from your search
foreach(System.DirectoryServices.SearchResult resEnt in
mySearcher.FindAll())
{
Console.WriteLine( resEnt.Path );
}
}
catch(System.Runtime.InteropServices.COMException ex)
{
Console.WriteLine(ex.Message);
}
|
|
|
|
|
I need to write a module for my program that will allow basic revision control of text files. I was wondering what is the best way to impliment this should i use a library? or should i just execute the commands myself?
Ive tried to use the .Net cvs library from the same people as sharp develop (http://www.icsharpcode.net/OpenSource/SharpCvsLib/default.asp) but i cant find any documentation for any of it... has anyone sucessfully used this library and if so could you give me some pointers.
Thanks
Tim
|
|
|
|
|
how to program with c# for exchange 2000
i want to get password in active directory .
how can i?
|
|
|
|
|
wangzhibin wrote:
active directory
I think System.DirectoryServices would help you here, not sure if it would allow to retrieve password.
For exchange server you can use CDO through COM Interop
- Kannan
|
|
|
|
|
Hi,
What's the "by the book" way under .NET to store application settings? (i.e. things you'd write to the registry under win32). I figure it's probably some XML file located with the app, but I need different data for different users, etc.
Italian is a beautiful language. amare means to love, and amara bitter.
sighist | Agile Programming | doxygen
|
|
|
|
|
|
I am developing an assambly .It is not a user control,but i want use System.Drawing.Color class. How should i do ?
waiting for answer.
thanks
SIMPLE IS BEAUTY
|
|
|
|
|
Add a reference to the System.Drawing.dll assembly.
The using statement (as it applies to namespaces and classes) just makes it so you don't have to type as much, it doesn't do anything to the actual code that is output. To actually use a new assembly you need to add a reference to it (in VS.NET right click on your project and choose Add Reference...on the commandline use the /ref:<assemblyname.dll> compiler switch).
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Question: I'm trying to update a progress bar with the load progress of a webpage. On my form I have a webbrowser control and a progress control. I'm trying to use the ProgressChange event but it fires for every item that has to be downloaded (images, etc). So when the page loads after the first item completes the progress bar is finished even though most of the page is still loading. My question is how do I know what the progress is for the entire page instead of simply an item?
Many thanks in advance.
- monrobot13
|
|
|
|
|
Not a C# topic, even if your source code is C# based. Probably the web development forum will be listening.
|
|
|
|
|
Why does the following line of designer generated code fail ??
this.imgTabImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgTabImages.ImageStream")));
Error:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation.
Thanks
|
|
|
|
|
I think this can happen if the image stream that is compiled as a resource is of a newer version than the ImageList win32 control supports. This will typically happen when you have VS.NET using the XP theme styles (by placing a devenv.exe.manifest file in the same dir as devenv.exe) but don't enable XP themes for your application.
This is because version 6 of the common controls writes a different format than the previous versions. I assume it is different because of the support for newer bit-depths.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
How would I convert a String variable to a byte[] array and back again?
I should say for completeness that the reason why is that I need to save large strings to a SQL server database and read them back again and SQL server "image" field type seems to be the best choice for this since I don't know the lengths that might come in. (they are emails in mime format)
|
|
|
|
|
J Cardinal wrote:
How would I convert a String variable to a byte[] array and back again?
Use the BitConverter Class[^], class members are listed here[^]
-Nick Parker
|
|
|
|
|
Ahhhh! Thank you. :eternal gratitude here:
|
|
|
|
|
Actually, I found that it's much more complicated than that when I tried it. Your method using bitconverter returns a string of text that represents the bytes (i.e. "12-24-fe" etc). What I wanted to do is go from unicode text to byte array then back to unicode text.
I did some scratching around and found that this works although it might not be optimal:
<br />
string sInput="The quick brown fox jumped over the six lazy dogs!";<br />
<br />
byte[] b = Encoding.Unicode.GetBytes(sInput.ToCharArray());<br />
<br />
<br />
Decoder d = Encoding.Unicode.GetDecoder();<br />
<br />
char[] ch= new char[d.GetCharCount(b,0,b.GetLength(0))];<br />
<br />
d.GetChars(b,0,b.GetLength(0),ch,0);<br />
<br />
string sOut=new string(ch);<br />
<br />
|
|
|
|
|
Usually when you're doing something that looks like it's a hackjob...you haven't looked hard enough for something in the Framework:
byte[] myByteArray = DoSomething();
System.Text.UnicodeEncoding encoder = new System.Text.UnicodeEncoding();
string result = encoder.GetString(myByteArray);
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
|
You should better use text or ntext field instead of image. You won't need any conversion in this case.
Alexandre Kojevnikov
MCP (SQL2K, Win/C#)
Leuven, Belgium
|
|
|
|