|
Try merging the two middle lines together:
DocumentProperties oCustomProps;<br />
oCustomProps = (Microsoft.Office.Core.DocumentProperties) objWordDoc.CustomDocumentProperties;<br />
oCustomProps.Add("Document ,false,MsoDocProperties.msoPropertyTypeString,"123456",null);
|
|
|
|
|
even this code throws an error but it is runtime error...regarding RPC
DocumentProperties oCustomProps;
oCustomProps = (Microsoft.Office.Core.DocumentProperties) objWordDoc.CustomDocumentProperties;
oCustomProps.Add("Document ,false,MsoDocProperties.msoPropertyTypeString,"123456",null);
error
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in OfficeDocument.exe
Additional information: The object invoked has disconnected from its clients.
|
|
|
|
|
Hmm I don't think I can help with that, I haven't used COM interop at all or any of the office programming components. I expect somebody will be along who knows what they're talking about!
Jon
|
|
|
|
|
Hi All,
I have downloaded SAP.Net connector from sap.com and with the help of the code available at http://www.codeproject.com/dotnet/SapDBReader.asp, I am able to connect to SAP R/3 System and fetch the data.
While fetching the data from the table having rows more than 200,000, It is giving the error related to BUFFER.
Can anybody help me out for this problem ?
Regards
Dilip
|
|
|
|
|
Yeah.
Don't start queries which will return more than 200000 rows. Seriously.
It does make more sense to have your software retrieve this in packages of maybe 10000 rows each, so you can continously update your view with the data already retrieved.
The SAP-Exceptions are the reason why I have designed all my Apps to use ConnectionPooling and asynchronous methods. I simply dont retrieve 200000 sets in a row, but more like 10000 per thread with 3 threads running.
Cheers
Sid
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I want to compile the dll conditionally, only when I want, or do you mean that the application should only load the DLL when it is needed.
My requirement is to have multiple .Net dlls, which has similar functionalities exposed (so that I can expose functions of same signature). One of these dlls should be loaded at runtime based on user's selection of dll file name. In effect I need to support my application in such a way that, even after initial deployment, I will be able to deploy additional dlls (additional dlls alone will be separately deployed), which user can select at runtime.
Shashidhar Reddy
|
|
|
|
|
Sounds like you are looking for something like the provider model in .NET v2,
also it might be worth while to have a look at the community server project[^], they have implemented a lot of this type of functionality.
|
|
|
|
|
You can use .NET reflection capacities. Recently I find an interesting project in C# called Purple#, the programer uses dlls like plugins, for example if you can render in D3D use D3D.dll, or OGL.dll for OpenGL. This Dlls implementes same interfaces.
This is the URL: http://www.bunnz.com[^]
|
|
|
|
|
i have created a button at runtime and want to form click event
handling during runtime.coding is like
class classname
{
Button b=new Button();
b.id=.......
b.Click += new System.EventHandler(_functionname);
...........
...........
...........
private void _functionname(object sender, System.EventArgs e)
{
Button bb=(Button)sender;
string urls;
urls=bb.id;
......
.........
}
}
but it is not working
Amit Kumar Katiyar
BhanuSoft tech Pvt. Ltd.
Noida
|
|
|
|
|
Have you added the dynamic control to the parent's controls collection?
class classname<br />
{<br />
Button b=new Button();<br />
b.id=.......<br />
b.Click += new System.EventHandler(_functionname);<br />
this.Controls.Add(b);
...........<br />
...........<br />
...........<br />
private void _functionname(object sender, System.EventArgs e)<br />
{<br />
Button bb=(Button)sender;<br />
string urls;<br />
urls=bb.id;<br />
......<br />
.........<br />
}<br />
}
|
|
|
|
|
thanks
but still its not working.this is a web application.
|
|
|
|
|
I need to destroy an object on the screen, there's only one of it and i just want it to die when i press a button
It is not created using an array or whatnot, because there will only ever be one.
Instead it is made using
character Maincharacter = new character (50, 50)
magical isnt it, but the only way i have found to remove an object (or a single intance of it) is by shoving it into an array, which i cant be bothered doing, so is there any other way it can be removed?
(there damn well should be, and if there isnt - someone should mae one )
|
|
|
|
|
how about Maincharacter = null
« Superman »
|
|
|
|
|
Good Day;
Does any one know a way to Reset/Change Passwords on mainframes?
Help will be appreciated;
Thanks;
|
|
|
|
|
What flavor of mainframe?
|
|
|
|
|
i wonder if there is a way to write a function using win32 API or .NET to automatically shut down windows xp when called.Then i can put the function in the comsumer application in WMI using the Start method to listen to the provider application which fires the event since the
System.Management provides the wrapper for WMI.
i am just curious about such an interesting problem.
welcome any advice
|
|
|
|
|
|
When implementing the IDisposable interface it is possible to use a class like this:
using ( MyClass myClass = new MyClass() )
{
...
} But it is also possible to use it without the using statement:
MyClass myClass = new MyClass();
... Question:
Is it possible to "force" a user of a class to always include it inside a using statement? (Maybe e.g. by applying some kind of attribute to that class)
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
AFAIK it isn't possible without some sort of code injecting/inspecting tool.
FXCop might have something like this already built in. And I know there is a free tool out there now for post compilation code injection, but I cannot remember the name of it now.
Beyond that, you could cheat the system a little bit and throw an exception from the Finalizer; just make sure your Dispose method calls GC.SuppressFinalize . If the Dispose method is never called on your object the exception thrown from the finalizer would alert them at some point in time about it..You would only want to do this in a debug build and probably need to capture a stack trace in the constructor so your exception thrown during Finalize can pin-point which object is causing the exception.
James
|
|
|
|
|
Great tip! Thank you, James!
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
Uwe Keim wrote:
Great tip! Thank you, James!
They don't call him Mister .NET for nothing!
Nish
|
|
|
|
|
Oh, I was unaware of that. BTW: Where is Heath?
--
Affordable Windows-based CMS for only 99 €: try www.zeta-producer.com for free!
|
|
|
|
|
Uwe Keim wrote:
Oh, I was unaware of that.
http://www.misterdotnet.com/blog[^]
Uwe Keim wrote:
BTW: Where is Heath?
Since he got Microsofted, he's been irregular in his posts
|
|
|
|
|
That reminds of a cute trick I learnt in C++. It is used to prevent people from mistakenly ignoring the return value of a function. Basically, it is a template class that has an implicit conversion to the actual return value of the function.
Off the top of my head,
template <typename T>
class Wrapper
{
T val;
bool used;
public:
Wrapper(const T &_val) : val(_val), used(false)
{
}
Wrapper(const Wrapper &w)
{
val = w.val;
w.used = true;
}
operator T()
{
used = true;
return val;
}
~Wrapper()
{
if (!used)
{
throw std::string("You forgot to use the return value");
}
}
};
Wrapper<bool> someFunc()
{
return false;
}
So bool v = someFunc(); will run smoothly, whereas someFunc(); will throw an exception.
Interesting use of destructors!
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I am having a problem converting an object. I am new to C# with a C++ background. I modified some sample code to gain some experience with classes and the associative array. My goal is to create my custom class and use the associative array to house instances of that class. Most examples show how to view the data with the console.writeline method (works for me also), but I would like to place the information in a local field at the main level.
I can store various instances into the array and view them in the debugger, but I cannot access them through main as show below. I get the following error message: Cannot implicitly convert type 'object' to 'ConsoleApplication4.Checks.
I would really appreciate some help.
Thanks,
public class Checks;
{
public Checks(int RegisterID, int CatID);
{
:
:
}
}
public class Register
{
public Register(int size)
{
:
:
}
public object this[int RegisterID, int CatID]
{
get
{
string key = Convert.ToString(RegisterID);
key += Convert.ToString(CatID);
return KeyToObject(key);
}
set
{
:
:
}
}
protected object KeyToObject(string key)
{
for(int n = 0; n < _count; ++n)
{
Checks trankey = (Checks)_items[n];
if(key == trankey.key)
return trankey;
}
return null;
}
}
class Class1
{
static void Main(string[] args)
{
Register Pay = new Register (1);
Checks temp = new Checks (5,3);
temp.Description = "Vons";
temp.Amount = 30.50m;
Register [5,3]= temp;
temp = new Checks(6,2);
temp.Description = "Home Depot";
temp.Amount = 126.75m;
Register [6,2]= temp;
temp = Register [5,3];
}
}
cab3
|
|
|
|