|
This really belongs in the ASP.NET forum, but more than likely you need to escape < with <.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I need some help with updating bookmarks in a Word 2002 document using a C# app. I'm new to all of this so if I haven't provided you enough info just let me know.
private void BookMarkReplaceRange(string bookmarkName, string newText)
{
object missingValue = Type.Missing;
object oBookmarkName = bookmarkName;
Word.Range rng = oDoc.Bookmarks.get_Item (refBookmarkName).Range;
rng.Text = newText;
object oRng = rng;
oDoc.Bookmarks.Add(bookmarkName, ref oRng);
}
//calling it with:
BookMarkReplaceRange("ptname","txtLName");
The code builds fine and when I run it it will run fine until it starts running the range code. When the document is displayed it has "bookmark not defined" in place of where the bookmark text should be. I'm getting an error at
Word.Range rng = oDoc.Bookmarks.get_Item(refoBookmarkName).Range;
object reference not set to an instance of object.
|
|
|
|
|
Hi!
There are two possibilities for the "object reference..." error:
Either you didn't assign anything to oDoc or the bookmark doesn't exist and thus cannot have a Range property (get_Item returned null).
Check both possibilities and you should be fine.
Regards,
mav
|
|
|
|
|
Thanks Mav
I didn't assign anything to oDoc. I'm new to programming so I'm still learning what the heck classes, objects, methods etc are. I guess the more I do, the more I'll learn.
Chad
|
|
|
|
|
i want use mask to transparence ,how can i do?
|
|
|
|
|
Just set the transparent colour in an ImageAttributes object and use the DrawImage methods that take it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
can you give me a sample?
i really need it,
thanks!
|
|
|
|
|
I'm looking for a WinForm control that emulates the look of the Month view of Outlook 2002.
I figure most of the grid controls out there will be able to do this. I'm looking for a control that scrolls and redraws reasonably fast. Each day of the view will contain at least three coloured sections ("appointments") - which must be dragable.
I've been looking at the various controls sold by Infragistics, ComponentOne and the like. They all seem like okay packages, so I'd like recommendations from existing users to which one they think is best.
Michael
CP Blog [^]
|
|
|
|
|
Hello all,
I wana ask a simple question!
How a Stream object can be saved into the disk?!!
Thank u
---
"Art happens when you least expect it."
|
|
|
|
|
Hi,
Stream is an abstract base class. You could use it's deriative, the FileStream for easy writing to a file using the BinaryFormatter class.
HTH,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
It greatly depends on what the stream is. More information would be helpful.
The snippet below - depending on whether or not the stream supports seeking - would work for many cases (but certainly not all, like with a NetworkStream - but not limited to it):
if (stream.CanSeek<)
{
stream.Seek(0, SeekOrigin.Begin);
using (FileStream file = new FileStream("file.dat", FileMode.Create,
FileAccess.Write, FileShare.Read))
{
int read = 0;
byte[] buffer = new byte[4096];
while ((read = stream.Read(buffer, 0, 4096)) > 0)
{
file.Write(buffer, 0, read);
}
file.Flush();
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I want to take a file as input and using PKZip or Win Zip extract it..All through C# code.
How to go about it??
|
|
|
|
|
|
Many Thanx....for solution.
|
|
|
|
|
|
I like this lib for doing zip/unzip.
http://icsharpcode.com/OpenSource/SharpZipLib/Default.aspx
Steve Maier, MCSD MCAD
|
|
|
|
|
|
Thanks Heath, sometimes posting from fireFox is just a pain, since I forget about the clickety.
Steve Maier, MCSD MCAD
|
|
|
|
|
I'm a student. My project group and I are doing a project - creating an appication for controlling stage lights. We code in C# and need to know more about DMX512 or where we can find info about it. We need to develop a dongle to communicate with the DMX devices. Help is needed urgently. Time is very limited! (Any info will be appreciated)
Thanx!
|
|
|
|
|
|
hi,
How can i know my dotnet application is not responding.
thanks
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
You can implement a "hearbeat" functionality:
An application is waiting for a hearbeat signal from your application and alarms if the heartbeat does not come after a certain time. Your application has then to create this heartbeat signal regularly (maybe in the working thread). The heartbeat signal can be a pipe or socket connection or something like that.
Hope that helps.
Greets
Roland
|
|
|
|
|
hi,
i am hearing this thing first time. How ? Where ? i start working on this new idea (for me)
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Sorry, but i haven't any Code that I can give to you, but I try to explain you the mechanism a little bit more specific.
The idea is to have a TCP/IP Connection between the Application thats needed to be observed (lets call it "Application A") and the Application that will observe Application A and create an alarm (Application B).
One application should be an "server" (create a socket and start listening) while the other should be the "client" (create a socket and connect to the server). When the connection between the two applications is established, you can send periodically (ex. all 10 seconds) messages from Application A to Application B (ex. "alive"). When Application B does not get an "alive" message 20 seconds after the last "alive" message, Application B should create an alarm, stop and restart Application A or do something else.
If you haven't worked with sockets under C# have a look at the various articles here on codeproject.
Hope you will get with this information a step further.
Greets
Roland
|
|
|
|
|
here nothing like two application.
My doubt is how i will know once my application is under "Not responding mode". I have only one application
**************************
S r e e j i t h N a i r
**************************
|
|
|
|