|
i have got code that use Microsoft spell checker, but when i tryed to compile it i have got erorr in this line:
////////////////
using Word;
//////////////
the erorr is :-
"The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?)"
so i wanna know how to make my application show word class
and thnx in advance
|
|
|
|
|
using Office = Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
i typed the full path but the code doesn't compile at all
this code is:
private void btn_create_Click(object sender, System.EventArgs e)
{
Microsoft.Office.Interop.Word.Application newApp = new Microsoft.Office.Interop.Word.Application();
l_status.Text+="object instantiated\n";
object Source="c:\\abc\\dat.doc";
object Target="c:\\abc\\Target.rtf";
object Unknown =Type.Missing;
// Source document open here
// Additional Parameters are not known so that are
// set as a missing type
newApp.Documents.Open(ref Source,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,ref Unknown);
l_status.Text+="file opened\n";
// Specifying the format in which you want the output file
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
l_status.Text+="new format created";
//Changing the format of the document
newApp.ActiveDocument.SaveAs(ref Target,ref format,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown);
l_status.Text+="new file saved \n";
// for closing the application
newApp.Quit(ref Unknown,ref Unknown,ref Unknown);
l_status.Text+="object closed \n";
}
===============================================
the error message is :
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in code_container.exe
Additional information: The server threw an exception.
|
|
|
|
|
hazzem elrefai wrote:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in code_container.exe
Indicates that the code has compiled. You have a runtime error.
What line did this happen on?
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
the error in the main finction line :
and i couldn't get any meaningful data from this erorr
static void Main()
{
Application.Run(new MainForm());
}
|
|
|
|
|
I suspect this is where the exception was CAUGHT. Not where it was generated/thrown.
static void Main()
{
try
{
Application.Run(new MainForm());
}
catch(Exception e)
{
Debug.WriteLine(e.Message);
Debug.WriteLine(e.StackTrace);
}
}
Will write to the output the location that the error was generated. This will help with solving the problem.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
i used try catch statements and the erorr is comming from this line:
newApp.Documents.Open(ref Source,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,
ref Unknown,ref Unknown,ref Unknown,ref Unknown);
plz keep with me and this will be apreciated
thnx another time
|
|
|
|
|
Colin, note that putting a try-catch around Application.Run only works when an exception causes the application message pump to terminate. This is usually not the case. The try-catch should be as local to the problem as possible (like in the original poster's code to create the Word app and open the document). You can also handle the AppDomain.UnhandledException event.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
Colin, note that putting a try-catch around Application.Run only works when an exception causes the application message pump to terminate
True, like happened here. I realise that the try...catch would be better placed else where but trying to help quickly I figured it was easiest to put round the Application.Run .
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
iam so confised now,coz i can not run my application yet
and i do not know what is the problem exactly.
|
|
|
|
|
Well, it looks like your code was copied from the documentation. So I don't see much difference between that and MSDN. Are you using a WordProject?
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
i do not know what is word project exactly
but if it is wizard in vs.net,then i do not use it and it doesn't there
iam using vs.net2003 profissional
thanx
|
|
|
|
|
I'm using VS2003 and Office 2003 (So it might be an office thing) Anyway - I've emailed you the skeleton of the WordProject - it might provide clues to help with your problem. (Its easy for me because it does all the hard work getting everything integrated - You may have to change the project properties because the startup command line may be different in your case)
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
thank u so so so much
and sorry coz i have to go know and c u after little hours
|
|
|
|
|
the erorr message say:
the server threw an exception
and nothing more.
|
|
|
|
|
Hi,
Does anyone know if the .NET framework has any support for easily creating property inspector style windows? Had a quick look through the available Windows Forms controls and components, but couldn't see anything of interest. Anyone any suggestions?
Cheers
Richard
|
|
|
|
|
You mean like the PropertyGrid ? This (or at least a similar control) is what VS.NET uses and it makes full use of the classes in System.ComponentModel so you can make properties with TypeConverter s and editors, as well as control the categories, descriptions, visibility, and other attributes using the attributes in System.ComponentModel . If you don't see the PropertyGrid in your toolbox, right-click on the toolbox and select "Customize toolbox". You'll find the PropertyGrid in there (it's in the System.Windows.Forms namespace).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Does anyone know how to make a exe that plays a video file in full screen?
|
|
|
|
|
You should take a look at Managed DirectX 9 (http://msdn.microsoft.com/directx[^]). The managed classes are written from the ground up and are much easier to use (still not a trivial thing to work with, though, so read the documentation!) and offer many features like that.
Otherwise, you'd have to create an interop assembly for something like the Windows Media Player, which should have a method to make it display full-screen (hint, download the small Windows Media Player SDK and see the documentation for player.fullScreen boolean property. This might also be in the MSDN Online Library).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi CodeProject member,
I got the fallowing code:
...
protected delegate bool ValidatorHanlder(object obj, ref string PropertieName, ref string ErrorNumber, ref string ErrorMessage);
PropertiesList = new Hashtable();
PropertiesList(StringProperty, new ValidatorHanlder(ZipCodeValidator));
public string StringProperty
{
get
{
return mStringProperty;
}
set
{
mStringProperty = value;
}
}
...
It is possible to reference the string by storing is pointer and not is value when added to the hashtable ? and if ZipCodeValidator is declare as static do i need to do a new pointer allocation on it?
(define Email (lambda ()
elacroix@devmesh.com))
Im not a church numeral im a free variable
|
|
|
|
|
System.String is a reference type already. If you try to modify the string, however, you will get the modified copy because strings are immutable. If you are trying to do this, use the System.Text.StringBuilder instead.
ZipCodeValidator is just a method. A delegate is like a managed function pointer. It doesn't care if the method is static or instance-based. You still need to use the new operator on the delegate, though.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I am attempting to develop an algorithm that will compare data in mutiple tables(e.g. Professors, Available Classes, Curriculum, Past Schedule) and create a new table that will be a become a class schedule for a department at a college. How can I create a new table in C#, without manipulating the database with MS Access itself.
|
|
|
|
|
First of all, C# is only a language that targets the CLR. It compiles to IL just like any other .NET language.
That being said, you can't do this in the .NET base class library (BCL). You can use ADO.NET to invoke SQL commands on many different data sources, but there is nothing to help you create tables, views, etc.
Depending on what database you are using, you can create COM interop assemblies to manipulate the database. You can interop DDL for Access and SQL DMO for SQL Server. I'm sure other major RDBMS's have similar libraries - at least those built with Windows technologies in mind.
This has been covered quite a bit in the last couple days so please search the comments (click Search Comments above) for this forum.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm trying to pass variables from my main.aspx page to the web user control page. I have a flash application that reads the variables and based on that displays a certain item that's embedded in the web user control page. The variable that I created needs to be on the main.aspx page, so when flash opens up it can tell which page it's on. It looks something like this:
This is on the control.ascx page, the problem with this is that it has to be on the same aspx page.
<param name="FlashVars" value="navStatus=<%=pageStatus()%>" />
This is on the main.aspx.cs page
public string pageStatus()
{
return "home";
}
I have also accomplished my goal by using session variables, but I don't want to use them. Is there is any way to inheret the function that's on the main.aspx or pass somekind of global variable to where it can be accessed anywhere. Remember that the variable needs to be in the main.aspx page, it can't be in a class library or component.
Thanks,
Jaime C
|
|
|
|
|
Do a Type-check and cast it. From the UserControl:
private void Page_Load(object sender, EventArgs e)
{
string value = null;
if (Page is main)
value = ((main)Page).pageStatus();
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|