|
hi,
sorry, it didn't work
public void shellControl2()
{
if(CustCd != "")
{
ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
// /c switch sends a command
startInfo.Arguments = "/C " + "\"" + @Convert.ToString(TempPath) + "\\fop.bat\" -xml \"" + @Convert.ToString(TempPath) + "\\ClientRecordCard.xml\" -xsl \"" + @Convert.ToString(TempPath) + "\\" + @Convert.ToString(TempName) + ".xsl\" -pdf \"" + @Convert.ToString(Salon.Library.GlobalVariables.Reports_Path) + "\\ClientRecordCard.pdf\"";
// redirect messages to this program
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
//don't execute using shellexecute API
startInfo.UseShellExecute = false;
//Don't open command prompt window
startInfo.CreateNoWindow = true;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(startInfo);
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
p.WaitForExit();
if (output.Length != 0)
{MessageBox.Show(Convert.ToString(output));
shellControl1.WriteText(output);}
else if (error.Length != 0)
{MessageBox.Show(Convert.ToString(error));
shellControl1.WriteText(error);}
}
}
This is the code snippit i'm using to send a command to command prompt to run the fop batch file to create a pdf file from xml and xsl files. if you can help it would be great. i had it working fine when all the files were in "C:\Reports\" But we had to move it to the derectory where the user installs the program and only the pdf file(Result) would be stored in the "C:\Reports\" directory.
He who laughs last...
-- modified at 9:09 Tuesday 30th May, 2006
|
|
|
|
|
Is this the code? you didn't change anything in here except putting all I've written to you in a variable that probably shows you a warning "command is never used"...
put it in the Argument, it is still the last one that doesn't work.
|
|
|
|
|
the argument is your code. the command variable was my code but i've taken it out
it gives the same error: "'C:\Program' is not recognized as an internal or external command, operable program or batch file."
He who laughs last...
|
|
|
|
|
May I ask what is the /C?
|
|
|
|
|
the /c is the command line switch that lets command prompt know to run the command. That is how i understand it.
He who laughs last...
|
|
|
|
|
Well maybe try without it?
Maybe it's \c and not /c?
Check some stuff out...
Are you sure it's with a space after it? try also that.
-- modified at 9:24 Tuesday 30th May, 2006
|
|
|
|
|
thanks for your time and thanks for trying.
Enjoy your day
He who laughs last...
|
|
|
|
|
No problems... but does it work or not?
|
|
|
|
|
not yet but ill let you know as soon as i get it right. There is something id like to try. but im not prommising anything yet. hold your thums
He who laughs last...
|
|
|
|
|
i've got it Thank you soooooooo much. All we needed was one more "\"" in the beginning of the code it should look like this:
startInfo.Arguments = "/C" + "\"" + "\"" + @Convert.ToString(TempPath) + "\\fop.bat\" -xml \"" + @Convert.ToString(TempPath) + "\\ClientRecordCard.xml\" -xsl \"" + @Convert.ToString(TempPath) + "\\" + @Convert.ToString(TempName) + ".xsl\" -pdf \"" + @Convert.ToString(Salon.Library.GlobalVariables.Reports_Path) + "\\ClientRecordCard.pdf\"";
The Bold part is the extra i was talking about.
THANK YOU! i've been strugling with this since last week Monday. Now i can sleep soundly.
He who laughs last...
|
|
|
|
|
When trying to construct a long string like this, it's much easier to troubleshoot if you start with a single substring and add mroe one at a time after checking the last one works as intented, by printing ot the console.
|
|
|
|
|
thanks for taking the time to try and help me. i've found the problem.
He who laughs last...
|
|
|
|
|
Hey
So I have a XML with DataSet in it, in the DataSet I have 2 DataTables, in each DataTable I have a Unique ID, and I did to this row, auto-inc, and don't allow DBNull, and it's readonly.
So when I try to do NewRow(), and add it without setting the ID column, it throws an Exception DataColumn 'ID' can't allow DBNull.
So how can I do it as UNIQUE ID? do I need to allow DBNull?
Thanks in advanced...
NaNg.
|
|
|
|
|
Hi,
I have hundrets of applications in excel from which I get data from c# - it works.. but some people changed the original pattern of the excel file (for example they merged some cells).. What to do? Is there eny posobility to compary only cells addresses?
Please give me some code maybe - the case is extremally urgent and I didn't know that people would change these documents for their needs....
|
|
|
|
|
No ideas ?
|
|
|
|
|
if the problem is with the user changing the excel file, any remediation will have to be in excel. You probably need to reissue the SSes so that a password is needed to make that sort of change.
|
|
|
|
|
Eventually the only thing I can do is :
someRange.MergeCells.ToString() - it returns true if cells are merged...
I would have to check all cells in rows which have critical values and are merged in charasteristic way...
I can't reissue them... Client want to have an info that this and this dcument hasn't passed the structural qualification...
|
|
|
|
|
I have a windows form with a single textbox. I have a few event handlers for some form events. When the focus is set to the textbox, and the user hits the Esc key, focus should be set to the form. But this is not happening.
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if ((int)e.KeyChar == 27)
{
this.Focus();
}
}
No matter what I did, the focus did not move out of the textbox. How to set the focus back to the form again.?
Please help.
|
|
|
|
|
I'm pretty sure that if there is a control on a form that can receive the focus, the form itself cannot receive the focus. For instance, if the only control on the form is a label box, the FORM gets the focus since the label box cannot get the focus, but if there are any controls on the form that CAN get the focus, the form does not.
HTH
|
|
|
|
|
I have created a graphic object on a tabpage as follows:
Graphics g = null;
g = tabPage1.CreateGraphics();
g.DrawString(str_1, fnt, brsh, x, y);
g.Dispose();
str_1 has been displayed successfully. But how do I clear the existing text and display another text on the tabpage (tabpage.Controls.Clear() didn't work)?
At the moment, the problem is that the new text is displayed on top of the existing ones.
|
|
|
|
|
You must draw the existing string using background color to clear it.
|
|
|
|
|
Well I was searching some information on RPC over HTTP programming in C#. I found many website that describe how to configure outlook 2003 for RPC over HTTP.
Well what is my requirement is I want to receive a mail of specific mailbox using RPC over HTTP from Exchange server programmatically in c#.
i.e. GetMail (username, password, server name);
I have credential of mailbox. By using this how can I make a request to check mail (mail related operation) (don’t know which format) to Exchange server (RPC proxy server)?
For example if I want to use POP3 protocol I will do following steps
Create tcp/ip socket and connect to server on port 110.
Using socket. send() method I will pass command following command
USER <usename>
PASS <password>
LIST –list all msg no
RETR <msgno> -display message
QUIT –logout
Here I know
• How to connect and which port is for POP protocol.
• How to send command
• Functionality of each command
• Response and the format of response
In same manner I am trying to understand about RPC-HTTP protocol. I think there should be some web service on exchange server that provide interface to login and to do mail related operation. I am not sure .
• How to send request (consume any webserviece or create httpwebrequest object o)
• Where to send request (which port 80 ,143 or 6001…)
• Under which format needs to send request
• What will be the response
• Format of the response (that enable how to parse the response)
• List of request command
How to go about this? I am stuck here.
Any help on this would be great to me.
UHS
-- modified at 10:32 Tuesday 30th May, 2006
|
|
|
|
|
Hi,
May be this is an easy thing for you, I am struggling with this as I am a beginner.I am trying to pass "'" to the javascript.
Example: "Nina's doll"
I must pass this sentence to javascript. I tried like this from C#
test=test.Replace("'","\'");
and also like this
test=System.Text.RegularExpressions.Regex.Replace(test,"'","\'");
If I give something else in the replace function insteadof "\'" it is working.
Please help me.
Thanks in advance
-- modified at 7:18 Tuesday 30th May, 2006
|
|
|
|
|
test=test.Replace("'","\\'");
So close
|
|
|
|
|
Hi,
I (newbie) have come upon the following problem:
I use a multiline text box, and want the scrollbars to show only when they are needed.
If TextBox was inherited from ScrollableControl, this would be easy since the DisplayRectangle Dimensions would be different from the ClientSize - whenever there are changes to the text box, I could check if the DisplayRectangle is bigger than the ClientSize, and then add the scroll bars.
But since TextBox is not inherited from ScrollableControl, the DisplayRectangle is always the same like the ClientSize.
Is there another way to find out the size of the virtual client size (besides calculating it from the number of lines and the height of the font)?
Thanks and best regards,
Christian
|
|
|
|