|
hello
when i open richedit in microsoft word format of text disappear
how can solve this problem
|
|
|
|
|
When you open an rtf in Word, the format disappears ? Are you sure ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
I'm working on a project that contains a function for receiving files as "print jobs" using standard "Raw" Port9100 printing (also known as "JetDirect" printing, but this really has nothing to do with HP JetDirects).
The program should receive a print job and then save it as a file. The idea of the "Raw" protocol from everything I've read is essentially just that it is, as the name suggests, completely raw. A connection is established, the data is sent and the connection is closed. (if anyone knows differently, please let me know!)
I have some code that looks somewhat like this (inside a loop of course):
<br />
TcpListener tcpl = new TcpListener(IPAddress.Any, 9100);<br />
tcpl.Start();<br />
if (tcpl.Pending())<br />
{<br />
Socket newSocket = tcpl.AcceptSocket();<br />
if (newSocket.Connected)<br />
{<br />
NetworkStream ns = new NetworkStream(newSocket);<br />
StreamWriter sw = new StreamWriter(filename, false);<br />
if (ns.CanRead)<br />
{<br />
while (ns.DataAvailable)<br />
{<br />
sw.Write((char)ns.ReadByte());<br />
}<br />
}<br />
sw.Close();<br />
ns.Flush();<br />
ns.Close();<br />
newSocket.Close();<br />
}<br />
}<br />
It appears to "mostly" work. The problem is that the data I get in the file isn't exactly the data I would expect. The print job appears "mostly okay", but there is some actual corruption in the data and it won't print to the printer when passed on. The print driver is PCLXL, so I can't read it by sight (like PostScript or PCL5), but doing a comparison with a hex editor to a "print to file" of the same original, I can see massive corruption in the data itself - the PJL header (which is plain text) is totally fine. However in the data itself (after the header), there appears to be hex C3 (unsigned byte 195) interspersed right through the file.
I THINK this is probably the fault of the fact that I'm casting ns.ReadByte() to char , and it's modifying the data in some way. However, StreamWriter doesn't let me write the byte directly. I could however be wrong.
Can anyone offer another way I could do this that won't have this problem?
|
|
|
|
|
Hi
Why do you use StreamWriter anyway? the way you initialize it, it will load the UTF7 Encoding which might be the problem here.
you could use a simple FileStream and write the bytes you've read from the NetworkStream directly into the file.
oh and one more little thing: flushing the NetworkStream will not help you, since you're only reading from it. flush the FileStream instead
hope this helps
greets
M@u
|
|
|
|
|
You're completely correct and now I feel somewhat like an idiot!
But thanks, a very small change to use FileStream instead of StreamWriter has solved the problem.
|
|
|
|
|
Hi,
I am trying to load a assembly thru reflection using:
Assembly asm = domain.Load(AssemblyName)
I understand that the assembly should also be in the currrent directory (DEBUG folder) in order to load it, though it is present in te location specified.
I have tried setting a new location as my current directory before loading, using:
Directory.SetCurrentDirectory(...)
But still it is not loading the assembly though the dll is there in that path and NOT present in the DEBUG folder.
Can anyone help me with this?
Thanks,
Priya.
|
|
|
|
|
I think Assembly auto searches assemblies in GAC and application folder. You'd better pass a absolute or relative path to it, rather than setting current directory...
|
|
|
|
|
Thanks for the reply but I didn't understand where I should pass the absolute path. The statement:
Assembly asm = domain.Load(asmName);
does not take a path. I am trying to load into a temporary domain and not the current App Domain.
|
|
|
|
|
i guess u r trying to load an assembly by specifying a path to a dll if so try the following...
System.Reflection.Assembly asmb = System.Reflection.Assembly.LoadFrom("dll path");
.....
|
|
|
|
|
Thanks for the reply. But this would load into AppDomain, I want to load into a Temporary domain which i created:
AppDomain domain = AppDomain.CreateDomain("TempDomain");
Thats why i am using:
domain.Load(Assemblyname)
|
|
|
|
|
I'm having the same problem here. Directory.setCurrentDirectory won't work because that method is, I think, for FileBrowsers.
I've tried to create the appDomain with appBasePath and appRelativeSearchPath but it still doesn't work (I get a FileNotFoundException). The Assembly is definitely in the path provided.
Did you solved this?
TIA
Jose Tavares
|
|
|
|
|
hi all
I wount to Create New project of Workflow Sequantiol Consol Application , but the VS 2008 Occure the Error : -
"C:\ Program Files \MSBuild\Microsoft\windows workflow Foundation\v 3.5\WorkFlow.Targets" was not found
Confirm That the Path in the <import>
declaration is correct , and that the
file exists on disk .
what is that error is Meaning ? and what is the Solve for it ?
How I Can Solve it ?
Thanks for any body Hellp me
Thaer
|
|
|
|
|
Im too poor to buy VS2008
|
|
|
|
|
thanks mr
but i wount To hellp from you , not to tell me you is poor
if you can hellp me do that
thanks mr Mark Brock
Thaer
|
|
|
|
|
Thaer Hamael wrote: what is that error is Meaning
Well.. a file has not been found. WorkFlow.Targets.
I found in another forum
Microsoft guy wrote: what that error is meaning is the targets files are not installed by the VS Extensions, they are installed by the Workflow runtime -> .NET FX 3.0. On Vista, this should have been installed by default and the targets files should be there as well. I haven't seen this particular issue before, so I don't have a fix for this. Can you try to uninstall and re-install the .NET Framework 3.0 and see if that repairs the install?
Maybe taking this advice, and also making sure you have .NET 3.0 installed will fix the problem?
Cheers,
|
|
|
|
|
I have trouble with calling a web method dynamically from a combobox which contains the different operations of a web service. My program can work with different web services navigated by a URL that is specified at runtime. The problem is that, the items of the operation's comboBox are not constant and they change if the web service in use changes, so when writing the code, I don't know the web service method which I want to call, and I want it to be retrieved from the combobox at runtime. If we assume that the web reference to the service is called wrg, I don't know how to call the desired method. I want it to be something like this, wrg."comboBox.Text", but this doesn't work... [Frown]
What should I do? [Confused]
I'll be thankful with your help [Smile]
|
|
|
|
|
You need to use reflection to do this.
And you should choose subjects that mean something. Everyone here wants help with C#
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you so much for your help, but I didn't understand what you meant & I couldn't open the link you referenced!!!
|
|
|
|
|
Hi ,
How to obtain the CPU usage of a single process(like the cpu column in task manager )using process id...
Thanks
SMitha Krishnan
|
|
|
|
|
Use System.Diagnostics.PerformanceCounter class...
.....
|
|
|
|
|
This[^] was my first hit when I googled. Do a search before posting here.
|
|
|
|
|
|
hi,
for backup and restore purpose i use SQLDMO. while restoring the database some tables are missed. Tables having varchar(max) field type are missed. Instead of varchar(max) it comes as varchar(-1) in query. SQLDMO generated sample query is given here
CREATE TABLE [newtest] (
[testno] [int] NULL ,
[testname] [varchar] (-1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
actually [varchar] (max) will comes here instead of [varchar] (-1). There is any direct way to solve the problem.
Thanks in Advance!
Have A Nice Day!
Murali.M
Have A Nice Day!
Murali.M
Blog
|
|
|
|
|
So what is your question? Nobody can help if they don't know what you need to know.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi
I want to ask that how can i add splash screen to my project, i am using Visual Studio .NET 2005 with c#.
Please give all the possible details ...
Regards,
Arfan Qadir
|
|
|
|