Answer Questions
ihatems2 How to use RectangleConverter?
I am constantly converting rectangles back and forth from int based to float based rectangle. I have noticed the RectangleConverter class, but there are no samples (that I can find). Does anyone have any experience with this class Right now I am constantly writing this code to convert from a RectF to a Rect Rectangle r = new Rectangle((int)rF.X, (int)rF.Y, (int)rF.Width. (int)rF.Height); And it is a big pain! I have even written a class that creates 2 rectangle objects and keeps them in sync. But there must be a better way. Any help would be much appreciated! Thanks, Bob The RectangleConverter class is used to convert string repretations to a Rectangle and versa vista. What yo ...Show All
Zero_ rtf to image
Hi, i need to transform the contents of a richtextbox (rtf) to an image. Any suggestions will be highly appreciated Thank you Would it be possible to do this in VB.NET. I know VB.net is very similar to C#.net, but I'm having trouble with some of the data definition syntax. A version of this code in VB.NET would be very helpful to me. Thanks Marshall Hi, precisely, i need an image of a rtf text - wiht colors, different fonts, sizes, alignement ... it would be great if someone already did something like that because there's many issues to consider on this problem and my time is limited Hello ogg, Thank you very much, i am developing powerpoint like application , as each slide has to b ...Show All
Grotius Why can't attribute parameters be dynamic?
I was looking at decorating a method with the PrincipalPermission attribute. It tried to do this: protected static string foo = "bar"; [PrincipalPermission(SecurityAction.Demand, Role = foo )] public void DoSomething() { } But it doesn't compile: "An attribute argument must be a constant expression, typeof expression or array creation expression" What the technical reason for this and do you think it would be good feature to have this, or better to leave it as it is I would be very interested in hearing your opinions on this, thanks! The value of the attributes paramters must be fixed at compile time. In your example, "foo" can change at run-time. If you change the line to prote ...Show All
Boy from Turkey Casting an object to a specified System.Type object
Although this seems like something that should be painfully obvious, the method eludes me... I need to cast an object to a specific System.Type object. It's more clear in code: ... int a = 1; int b = 1; Compare(a,b,typeof(int)); ... public bool Compare(object intA, object intB, Type type) { return (intA == intB); //returns false } How do I cast intA and intB to integers without doing so explicitly I need to cast them using the System.Type object, since it is unknown within Compare that these are int types. Try public bool Compare(object intA, object intB) { return intA.Equals(intB); } Try to read a little bit about == operator, Equals, ReferenceEquals; The differences between these when app ...Show All
GregRoy Newbie in C#, the problem about 2 dimension array descending sort.
Hey all, I met the problem about 2-dimension array descending sort. E.g. int [,] intarry = new int {{0,1,2},{0,3,4},{0,2,3,}} I wanna have this intarry in terms of descending sort, as the 2nd item. E.g. the expected result will be intarry = {{0,3,4}, {0,2,3},{0,1,2}} From the information that I got from webstie, the 1 dimension array can be applied by reverse method of array. However, for the multiple array, the Comparer should be written. Furthermore, there are few information availble and one even with the commerical application, e.g. you have to pay for it in order to see the possible solution. :0( I am a little new in c#. Therefore, I may need some helps from you.... According to my case, can you do k ...Show All
Catherine Parkhouse Passing Hash Table from C# to unmanaged Code in C DLL.
Hello, Is there any possibility of passing a Hash Table from the C# application to a C DLL function, and use that hashtable in the C DLL. Or is is possible to pass the maps from pure C DLL to C#. Need help in this regard. Thanks for your reply. I just wanted to know whether there is a possibility or not. No on both counts. In each case you are dealing with classes that have data that can't be marshalled properly. You'd have to define classes in unmanaged or managed code but this would be dependent upon the underlying implementation of the classes which could change. Instead you should serialize the data into a more consistent format. A good choice would be ...Show All
v04bvs myprocess.Start() is not working for me in .net 2003
Do u know pls why this code doesn't execute my batchFile.exe what am I missing Thank you System.Diagnostics.Process p=new System.Diagnostics.Process(); p.StartInfo.WindowStyle=ProcessWindowStyle.Maximized; p.StartInfo.FileName=@"c:\dev\myFolder\myBatchFile.exe "; p.StartInfo.UseShellExecute = false; p.Start(); p.WaitForExit(); Thank you Hi, please post the error you are getting when you run the code. Hi Are you developing in ASP.net or Windows Application I suggest you move the FTP functionality into a DLL that your aspnet app calls directly. it uploads and downloads some files from and to ftp server. I mean all am trying to do is execute a .bet file ...Show All
Latso simple console question
I have a simple console project that I want to pass 2 arguments into. Here is a simple example of the code that I have. static void Main(string[] args); { string somevar = args[0]; string somevar2 = args[1]; doSomething (somevar, somevar2); } I want to run the program like this. C:\testapp.exe "C:\documents and settings\administrator\application data\testapp\" "C:\documents and settings\administrator\application data\testapp\toBeUploaded.zip" I tried it with and without the quotation marks but it appears that the program is only getting C:\documents for the first string and "and" for the second string. How do I get arount this You could try using the old MS-DOS name (8.3 forma ...Show All
Krenshau75 simple questions related to C sharp
1- Sometimes we use ( ) like in : Mydatatable.columns.add(….) and sometimes we use [] like in arrays. When do we use [] and when we use () in C# 2- why do we use TypeOf() in C# and gettype in VB. any explanantion pls 3- Sometimes string and sometimes upper "S" : String like in TypeOf(String). when do we use string and when do we use String Thank you 1. In C# whenever you see ()’s used it means that you are calling a method while the use of []’s means that you are passing in an array index or key into an array type object. 2. The language designers opted to implement the same functionality in slightly different ways based on their views of the language and its uses. Similar cases can be found throughout. 3. ...Show All
amullane Interacting with an external application (process)
Hello! I'm trying, with VS.Net 2003 and C#, to call an external command line application and retrieve the output several times during its execution (that can be long), so I can track the process and give the user an estimated time to complete. What I did: I created a process and a timer with 500ms tick. I start both at the same time and every tick I read the process' output. The problem: everytime I try to read the output using "StandardOutput.ReadToEnd()", the application freezes and only resumes when the external application is done. Using the search on this forum I found out that I had to use "Application.DoEvents()", so the application could resume the message queue, but it didn't work. So far, that's what I'm doing ...Show All
ClaudiaHelpOnVSTO Reflection - unloading assemblies !
How can i unload an assembly from memory after reflecting on it I need to move the file. I'm loading the assembly using Assembly.LoadFrom(some_path). 10x Hi AppDomain apd = AppDomain .CreateDomain( "Test" ); System.Reflection. Assembly asm = apd.ExecuteAssembly( "som_path" ); //Do some thing with Asm AppDomain .Unload(apd); I see your point but apd.ExecuteAssembly(...) would actually return an integer (the return code). Sorry - it's not this one ! Akbar Khan wrote: Hi AppDomain apd = AppDomain .CreateDomain( "Test" ); System.Reflection. Assembly asm = apd.ExecuteAssembly( "som_path" ); //Do some thing with Asm Ap ...Show All
NJCoughlan why does vs2005 pro ide load so slowly?
Hi, When I reopen the VS2005 it takes 10 -15 seconds which is much longer the older versions of VS do. The current project is not necessarily large and I blanked out the start page news channel in help options and unselected the download content checkbox. It's annoying that such a good product starts this way. Is there a setting I missed This is on a 3 gig ram/fast machine. thanks, Joe Hi, Bill Gates once complained that no matter hardware he had a C compile took several seconds. Fifteen is the slowest (just to load the IDE) since I worked at Bell Labs in the early eighties. Actually Vi and emacs loaded faster and make files could take longer to compile but the load time is really slow ...Show All
Mark Flamer Return memory information?
Is there any way to retreive the computer memory information I am currently running WindowsXP SP2 and have 512MB of physical memory. How can I return this in C# Thanks, Thank you very much for your reply! I have been trying to fugure this out! I will be sure to try your code! Thanks again, Is this in bytes Yes, Here is further conversion, If you need: Utility.GlobalMemoryStatus(out ms); int bytes = (int) ms.TotalPhysical; int kBytes = bytes / 1024; int mbytes = kBytes / 1024; Console.WriteLine(mbytes); // In Mega Bytes I hope this will help. Best Regards, Rizwan aka RizwanSharp Add this class to your code: public static class Utility { [DllImport("kernel32.dll" ...Show All
Ian Barber How can I send and e-mail using exchange server that check for credential?
Hi friends, Now I have to create a tool to send an e-mail in my office internally. My office uses MS Exchange and check for credential before sending an e-mail. I tried to create a tool by simple code like create a message and send but it crashed while it was trying to send. An exception was "System.Net.Mail.SmtpException: Client does not have permission to submit mail to this server". So how can I add my credential into sending process Thank a lot, check this link.. hope it helps you.. http://www.codeproject.com/dotnet/SystemWeb_Mail_SMTP_AUTH.asp ...Show All
Jan Kučera Get am image from the PrintDocument Object.
Hi, Can any one tell me how to get am image from the PrintDocument object. If so can you please provide me a code snippet for this. Thanks, ...Show All
