|
I need to generate some reports in XLS format and I want to code something in C# that will allow me to manipulate the files. I have seen some basic read/write solutions on this site. I am interested on how i can change the color of a specified cell int the spreadsheet or merge a few cells . Any help or link is greatly appreciated.
|
|
|
|
|
Hello,
I have a question. I want to make a small designer for my application. For that I use the DesignSurface class. this all works very fine, but now I have one small problem too. The standard view (surface.View) has as background another control and the real control which I design is not on (0,0) . For some reason I need the position of (0,0) for the control to design. Knows anyone a solution for this?
Regards
Hansjörg
|
|
|
|
|
Hi guyes
Does anyone know how to convert the data in a dataset into an array.
All the best
Al
|
|
|
|
|
array of what? datarows, strings, objects?!
anyway you have to iterate through Rows in Tables in the dataset adding data to desired array
life is study!!!
|
|
|
|
|
how to create Create Windows User Account or Windows Administrator Account through C# programming.
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
first of all read : http://www.codeproject.com/script/comments/forums.asp?forumid=1649&mpp=50&select=1278604&df=100&noise=1#xx1278604xx
then i guess the easiest way is to use Process.Run("net","...");
Process is in System.Disgnostics.. the "..." is the syntax of 'net' command, if you don't know it Start->Run-> "cmd" -> type: "net /?"
life is study!!!
|
|
|
|
|
|
yes. make the object public and add a refernece.
|
|
|
|
|
Nonsense! You cannot make an "object" public, you can make a "class" public.
What she is looking for is called "IPC" - Inter Process Communication. Take a Google search for it [^].
|
|
|
|
|
You need to provide more info. Do you want to pass an instance of an object between apps, or do you want to create a class, and use instances of that class in different apps ? Or something else ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Christians,
There is one application which is developed totally on c#. At runtime I want to make use of one of the objects of these application from another application that too is developed in c#. But in the first application I cannot make any modification or the channel informations are not available otherwise I could have used remoting. There is a method "GetActiveObject" but it is working only for unmanaged objects (I think). Is there any method equivalet to this which can give the referece of the active or running objects?
Thanks
Diana.
|
|
|
|
|
OK, you want to access an object, an instance of a class, inside another app ? You really cannot. If you can't change the program, there is absolutely no way you can pull an object out of it. The other program needs to anticipate and respond to your attempts to communicate.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Ok, Thanks.
But how is it possible with "GetActiveObject" method for unmanaged objects?
Diana.
|
|
|
|
|
I've never used them, but it looks to me like they work with COM objects. A COM object has a defined public interface, the author has already defined a method to interact with an external program.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
FYI...
It is possible to attach a dll into a process from a different process and invoke a static method available with that dll. So it is possible to enter into a process and do whatever there, though we can't access the data back to the attaching process. If interested to know more see the article ".NET Object Spy and InvokeRemote".
Thanks
Diana.
|
|
|
|
|
Are your applications all on the same machine?
You might want to try Enterprise Services.
.Net remoting also works well and you can setup singleton objects which would be shared by all connecting clients.
Services are useful if you want highly persistent objects. maybe combined with one of the methods above.
Persisting the objects to an XML file or database might work if your design is very simple.
As always the solution depends on what you are trying to achieve.
HTH
Russ
|
|
|
|
|
Hi Russ,
Bothe applications are running on the same machine. As I don't know the channel informations, I cannot use remoting as well as I cannot modify the application. I would like to know is there any method similar to "GetActiveObject" available for this?
Thanks
Diana.
|
|
|
|
|
When an exception is thrown in my application I use a PropertyGrid to dynamically show the exception to the user, allowing him to inspect all details.
I also log the exception to a log file (through LOG4NET).
Now I would like to be able to not only log the standard properties of the catched base Exception object but also any (nested) properties of derived exceptions (e.g. the Response property of a WebException and therein the ResponseUri property of that Response property).
Question: How can I do this in a "generic" way?
I already started doing some simple reflection but didn't manage to detect the type of the property and to decide whether to dig deeper or simple to call and output the ToString() method.
Any hints, please?
|
|
|
|
|
Hello,
I'm not sure if I complettly understand the complexity of your question.
I'm using Reflection in combination with Cloning of UserControls, where I whant to get the public properties values.
Works like this:
using System.ComponentModel;
PropertyDescriptorCollection pdcMyControl = TypeDescriptor.GetProperties(MyControl);
foreach(PropertyDescriptor pdMyControl in pdcMyControl)
{
System.Type pd_typ = pdMyControl.PropertyType.GetInterface("ICollection");
if (pd_typ != null)
{
ICollection ItemsMyControl = pdMyControl.GetValue(MyControl) as ICollection;
foreach (object obj in ItemsMyControl)
{
}
}
else
{
}
}
Maybe it helps!
All the best,
Martin
|
|
|
|
|
- To get all the properties of a type, use the
Type.GetProperties() method. Pass in the following binding flags: Instance , Public , FlattenHierarchy . This makes sure that only public members that are instance rather than static are returned, and that inherited properties are included.
- To get the data type of a property use the
PropertyInfo.PropertyType method. - A simple way to see if a property's type is one of the basic types is to check if
Convert.GetTypeCode!=TypeCode.Object . - Watch out for circular reference paths! Check each time before you output an object's properties to make sure that the object isn't already currently being output.
- A property value may be part of a large object graph, and outputting the whole graph as text could bring the app to its knees. Consider limiting the recursion depth.
I've got some fairly nifty code for outputting object hierarchies, but I haven't tested it thoroughly. If you reply by email and give your email address, I can send it to you.
|
|
|
|
|
Hello All:
I'm using C#.Net.
I have three TextBox forms A,B,C waiting for the input from the user. I would like to
call the external application which will include these inputs parameter from user's Input from TextBox
A,B and C. Here is part of my code:
System.Diagnostics.Process proc; //Declare New Process
System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo();
procInfo.WorkingDirectory = "C:\\PushCase";
procInfo.FileName = "PushCase.exe";
procInfo.Arguments = tb_params.Text; // since I have three separates TextBox A,B,C. How do I make it into
// single parameter??
proc = System.Diagnostics.Process.Start(procInfo);
Thanks in advance!
|
|
|
|
|
You can use Process.Start, and put the parameters on the command line, comma seperated. Of course, the app you're calling needs to expect them, in that order.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
For ex., if you use internet explorer with a parameter
System.Diagnostics.Process.Start("IExplore.exe","http://10.109.25.15/TouchScreen/Test/index.htm");
|
|
|
|
|
Hello,
You just have to set a " " (space) between the Text properties.
Like this:
procInfo.Arguments = tbA.Text + " " + tbB.Text + " " + tbC.Text;
Your Arguments would be:
[STAThread]
public static void Main(string [] Args)
{
if(Args.Length == 3)
{
}
for(int x=0;x<=Args.Length;x++)
{
}
}
All the best,
Martin
|
|
|
|
|
Thank you guys for your help!
|
|
|
|