|
Try this:
using System;
using System.Collections;
using System.Collections.Specialized;
public class ScriptingUtils
{
public static IDictionary ConvertDictionary(Scripting.IDictionary dict)
{
HybridDictionary ret = new HybridDictionary(dict.Count);
foreach(object k in dict)
{
object key = k;
object value = dict.get_Item(ref key);
ret.Add(key, value);
}
return ret;
}
} You can then change your code to:
using System;
using System.Collections;
...
string ADsPath = "LDAP://CN=Some List,OU=Distribution Lists,DC=DomainA,DC=CorpA,DC=com";
AGQueryClass ag = new AGQueryClass();
ag.Set(ADsPath);
IDictionary dict = ScriptingUtils.ConvertDictionary(
(Scripting.IDictionary)ag.Parameters);
object[] keys = new object[dict.Count];
object[] values = new object[dict.Count];
int index = 0;
foreach(DictionaryEntry entry in dict)
{
keys[index] = entry.Key;
values[index] = entry.Value;
index++;
}
...
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Yes, that did it! Thank you Richard.
|
|
|
|
|
I may be being thick but I'm having problems using .CreateInstance
Dim ty As Type<br />
ty = Type.GetType("System.Windows.Forms.Textbox", True, True)
You'd think it would return a textbox type! But it errors beacuse it's trying to look for the textbox in my namespace:-
Could not load type System.Windows.Forms.TextBox from assembly xmlForms
Any ideas?
|
|
|
|
|
No, Type.GetType() won't return a TextBox , it'll return a Type . That Type is defined in the System.Windows.Forms assembly. Since you didn't get an assembly reference, the class is assumed to be in your assembly, *not* your namespace. Namespaces can span assemblies and vice-versa.
If you need to get a Type from a string, you need to specify the fully qualified assembly info, like so:
Type t = Type.GetType("System.Windows.Forms.TextBox, System.Windows.Forms, " +
"Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", true, true);
That'll tell the type loader to get that type out of the System.Windows.Forms assembly, no yours. If an assembly is in the GAC, you can just specify the fully qualified classname and the assembly. The type loader will use the latest version of that assembly. If an assembly is not in the GAC, you have to specify all type properties or use a publisher policy to to specify which version and from where the assembly comes.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Thanks Heath, that works
|
|
|
|
|
Hi
i would like to disable/hide the Close button "X" on the upper left corner, also the hot keys like control + F4, to close mdi child, should be disabled. I like to group some mdi childs, and only one child should be enabled to close. This childs than close the other ones.
Is there any way under c# ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
To keep the window from closing, handle the Form.Closing event and set the CancelEventArgs.Cancel member to true . As far as disabling the Close button, MSDN suggests removing the Close system menu item from the control bar. To do this, you'll need to P/Invoke GetSystemMenu from user32.dll and RemoveMenu from user32.dll. See "Q184686" in Microsoft KB. It's in VB, but the concept is the same.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
thanks, i will take a closer look ,)
.:Greets from Jerry Maguire:.
|
|
|
|
|
It's easy, just set ControlBox to false, and the Close Menuitem and Button are disabled.
.:Greets from Jerry Maguire:.
|
|
|
|
|
i have never used toolbars before...so humor me ( i have never needed them) anyways how can i seperate my buttons with just a panel on my tool bar.. kinda like MenuItem jr = new MenuItem("-"); in the menu. anyways thanks for the time
Cheers,
jesse m
|
|
|
|
|
if i get you right, you wish to use the System.Windows.Toolbar Control, you create a new button and set his style to "Separator" or something similiar like that.
.:Greets from Jerry Maguire:.
|
|
|
|
|
Hi,
how can i subclass office apps, that they run in my own form ?
something like
officeApp.DockStyle = Fill;
officeApp.Parent = myForm;
does somebody had a sample or a link about this ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
How can I draw lines and shapes with GDI+ on a pictureBox device and save or export my drawing to an image file (*.bmp,*.gif) on the disk?
I tried the "Image.Save()" method but it didn't save what I draw...
Moshu
|
|
|
|
|
Create your Bitmap (does not mean .bmp file) from a Graphics object using the Bitmap(int, int, Graphics) constructor (or, if your Graphics object was created from the Bitmap, do nothing) and use Bitmap.Save specifying a PixelFormat of whatever image type you want (and is supported).
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Is it possible to open up MS Project2000 files inside a windows form. I can open up a word document inside a form by using the AxWebBrowser. Is there any control or something for doing this?
|
|
|
|
|
I'm referencing a DLL in a C# application and it works fine(Both a forms and console app tested successfully). However, I wish to expose the DLL VIA SOAP. For some reason, the DLL just fails. It doesn't work .. Any ideas ?
Its a DLL from Novell that authenticates users and can transverse a NDAP directory. It was meant to be called from VB6.
Is it wrong to think "if it works in the app it can be referenced and exposed via S.O.A.P ??
Any ideas ??? Anyone ?
|
|
|
|
|
I am looking for a way to send a float[,] accross a tcp/ip socket connection.
Can I convert this to a byte[] somehow without itterating through each element?
Is there some easier way than using a NetStream?
Thanks for your assistance.
(I would like this to work for Arrays up to 30 million elements)
Deane
|
|
|
|
|
These static functions will allow you to create byte[]s from the float[,]s and then convert them back.
<br />
using System;<br />
using System.Runtime.Serialization.Formatters.Binary;<br />
using System.IO;<br />
<br />
public class Utility<br />
{<br />
public static byte[] TwoDFloatArrayToByteArray(float[,] floats)<br />
{<br />
MemoryStream mem = new MemoryStream();<br />
<br />
BinaryFormatter bf = new BinaryFormatter();<br />
<br />
bf.Serialize(mem,floats);<br />
<br />
return mem.ToArray();<br />
}<br />
<br />
<br />
public static float[,] ByteArrayToTwoDFloatArray(byte[] bytes)<br />
{<br />
MemoryStream mem = new MemoryStream(bytes);<br />
<br />
BinaryFormatter bf = new BinaryFormatter();<br />
<br />
float[,] floats = (float[,])bf.Deserialize(mem);<br />
<br />
return floats;<br />
}<br />
}
I can't really help you with the TCP/IP problem. All I can say is "Compress those byte[]s before transmission!". 30 million floats is 120mb... Hope you have a fast connection.
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thank you very much, that looks like exactly what I was looking for.
Compression is definitely next on the todo list and should prove to be quite effective given the sparse nature of the data.
Deane
|
|
|
|
|
For a compression library, check out SharpZipLib[^]. This is an easy to use library and is very good using standard algorithms. It is completely written in C#.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
When I set create a new form and set the parent form for it, the ctrl-c ctrl-v shortcurt stop to work. If I don't set the parent it works fine.
What's happing?
Thanks...
|
|
|
|
|
1. I can't find the files "System.Text.RegularExpressions.dll" or "System.WinForms.dll"...May I ask if it is bundle with VS.NET or SDK itself?
2. May I ask if there is any Reference of Framework Class Library available to download, just like the API from java?? Since I want to develop my program with my notebook, but I didn't install any VS.NET at all.
Thank you very much for your attention.
Regards,
Riddler
|
|
|
|
|
- The namespace
System.Text.RegularExpressions is defined in system.dll ;
The WinForms namespace was renamed after an early beta. It is now called System.Windows.Forms , and is hosted in the file System.Windows.Forms.dll ; - Check out Lutz Roeder's Reflector: http://www.aisto.com/roeder/dotnet/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
I am writing a windows forms applications with c#
i want the files saved by application with a certain extension be opened by my program i.e. When user double click file , my program executes certain code like open , add to zip actions
I want to know how to add code to program that function
knowing that i am using a setup program to register my file types
All what i get that my application is called ,but the function i mentioned int the verb property is not called
thanks
Wella
|
|
|
|
|
you will probally need to work with The Environment.GetCommandLineArgs();
command....this is a exsample from my program..it may work for you maybe not. if you want more help or questions about this code...(i tryed to mark it atleast kinda clear) email me at res1s5yd@verizon.net
oh and too set up your program too load as the default for that specific file typ try looking in HKEY_CLASSES_ROOT in the registry.... goto txtfile for a hint.
jesse M
<br />
<br />
String[] arguments = Environment.GetCommandLineArgs();<br />
int count =0;<br />
foreach(string jr2 in Environment.GetCommandLineArgs()){ <br />
count++;<br />
string ComandArgs = jr2.ToLower();<br />
int[] jr = new int[]{1};<br />
try{<br />
if(count !=1){<br />
<br />
switch(ComandArgs.Replace("-","")){<br />
<br />
case "fullscreen":<br />
FullScreenFlag=1;<br />
break;<br />
case "min":<br />
FullScreenFlag= -1;<br />
break;<br />
<br />
default:<br />
if(File.Exists(ComandArgs.Replace("-","")))
{<br />
LoadFileOnStart = ComandArgs.Replace("-","");<br />
break;<br />
}<br />
MessageBox.Show("Invalid CommandLine Arguments..\n\nYou Wrote : "+ComandArgs.Replace("-","")+"\n\nValid Command line Arguments are : \"fullscreen\" To Load FullScreen on startup, \"dcheck\" To Disable Registry Check on Startup, \"min\", To run program minmized. \nSpace is required after each Paremeter","Invalid Paremeters",0,MessageBoxIcon.Warning);<br />
<br />
before my program load's i added the following code to adjust acording too the command like args
<br />
switch(FullScreenFlag){<br />
case 1:<br />
this.WindowState=FormWindowState.Maximized;<br />
break;<br />
case -1:<br />
<br />
this.WindowState= FormWindowState.Minimized;<br />
break;<br />
case 0:<br />
break;<br />
}<br />
hope...it helped a little......
|
|
|
|