|
|
can any one giude me how to convert ...below vb.net code to C#......
Dim oDoc As Word.Document
Dim oBuiltInProps As Object
Dim oCustomProps As Object
Dim oProp As Object
Dim strValue As String
'Get the Custom Document Properties collection.
oCustomProps = oDoc.CustomDocumentProperties
'Add a property named Status Report
'and give it a value of 4th Qtr.
oCustomProps.Add("DOCID", False, _
Office.MsoDocProperties.msoPropertyTypeString, "123216")
major problem is with oDoc.Custo mDocumentProperties which returns object...how t o do the same thing in C# where oCustomProps.add is not coming?
urgent plz help me out?
|
|
|
|
|
The problem is in declaring oCustomProps as Object. You need this to be of the correct type (DocumentProperties?) so that the Add method is available. In VB.Net:
Dim oCustomProps As DocumentProperties<br />
oCustomProps = oDoc.CustomDocumentProperties<br />
oCustomProps.Add(.....
in C#:
DocumentProperties oCustomProps;<br />
oCustomProps = oDoc.CustomDocumentProperties;<br />
oCustomProps.Add(.....
Hope that helps
Jon
|
|
|
|
|
hai..
i have i tried this but it says it cannot convert object to microsoft.ofice.core.documentproperties
here is my code
DocumentProperties oCustomProps;
oCustomProps = objWordDoc.CustomDocumentProperties;
oCustomProps = (Microsoft.Office.Core.DocumentProperties) oCustomProps;
oCustomProps.Add("Document ,false,MsoDocProperties.msoPropertyTypeString,"123456",null);
|
|
|
|
|
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
|
|
|
|