|
|
This has been posted in the .NET forum and (correctly) int the ASP forum.
|
|
|
|
|
You've posted this in 3 different forums, and the answer is easily Googled.
|
|
|
|
|
How can I save an Excel file which will prompt user to select where to save? What save mode should I use?
|
|
|
|
|
More detail is needed.
Is this a web app? WinForms? Excel VBA code? What?
How are you generating the workbook to "save"??
There's no such thing as a "save model". Your use of the term could mean anything.
modified 15-Aug-12 8:06am.
|
|
|
|
|
Prompting the user for a save-location is done using the standard SaveFileDialog . It doesn't matter what type of file you want to save, the dialog is always the same.
Check out the documentation[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Ladies And Gentlemen:
Here I use a SerialPort to send and receive message(of Bytes).
But it cannot really work.
MCU can send a string to PC, and PC can send a string to MCU too.
The problem is , when PC sent a string first,later when you about to send a string to PC from MCU ,it losts a byte,the first or the second one.
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
int temp = serialPort1.ReadByte();
if (IsAddrConfirmed == 0 && NeedAddrConfirm == 1)
{
IsAddr = confirmAddr((byte)temp);
IsAddrConfirmed = 1;
}
if (!IsAddr && AddrBacked_2 == 1)
{
try
{
textBox3.Text += "temp是:" + temp + "\r\n";
textBox3.Text += "收到字符串:" + (char)temp + serialPort1.ReadLine() + "\r\n";
When dataReceived,temp got a value
Look at the last two or three lines ,is it the point?
Thank you very much,but sorry for my bad English.
Little bird looking for heros
|
|
|
|
|
You're right, the English is rough, but we'll work through that... The sample code is interesting, but far too little to make an educated guess. The non-English characters are confusing to us, but to a serial port, bytes is bytes - it doesn't care. There's a clue in the fact that the first couple of bytes are being lost, I think. The fact that you get any meaningful data at all indicates that you have the baud rate set correctly, so we can forget that. But the handshaking might be mismatched. The PC port and the MCU port must be set to use the same protocol in order to properly sync the messages. Modern PCs will attempt to auto-negotiate handshaking if the mode is set to 'none', I believe, but MCUs aren't as sophisticated. Confirm that the handshaking protocols are identical.
Another possibility is that you (or the MCU) are expecting to have the PC's undivided attention to the data stream incoming on the serial port. That's not the case with a multi-tasking OS like Windows. You'll want to dedicate a thread to listening on the serial port with a fairly high priority in order to catch the leading bits of a randomly-generated message from the MCU. If you don't, Windows may be off doing something else when the first couple of bytes arrive, and they'll be lost.
Post a bit more of your code so that we can see what you've set up the system to do, and feel free to post the MCU code, as well. It helps to see what both sides of the conversation are expecting from each other. I know that serial communications is old and well established, but it's quirky at best, and the "standard" isn't too well enforced. Every bit of information you can provide will be helpful.
Will Rogers never met me.
|
|
|
|
|
I am trying to scrape a web page. The URL is
http://reports.ieso.ca/public/GenOutputCapability/PUB_GenOutputCapability.xml
If I open the link in a browser window there is information about when the report was created, totals, etc. If I scrape the URL from C# using a WebClient or WebRequest, only the XML file is returned. It appears that much of the information on the page is stored in a dymanically created style sheet on their web site.
Is there a way to use a WebClient or WebRequest to get exactly what I see on the web page?
Thanks,
Mark Jackson
|
|
|
|
|
Dunno. Maybe try the WebBrowser control and check its document property.
|
|
|
|
|
Some idiot voted you a 1 for a perfectly reasonable answer.
Countered.
|
|
|
|
|
Oh, thanks.
|
|
|
|
|
It isn't an html page (if that's what you mean by a web page), it's XML. The XML contains a link to a stylesheet:
="text/xsl"="http://reports.ieso.ca/docrefs/stylesheet/GenOutputCapability_HTML_t1-1.xsl"
This is used by your browser to transform the XML into HTML, which it displays (assuming your browser supports this).
If you are using the WebBrowser (as Piebald Consultant suggests) control, you might need to transform yourself. This article has a basic outline of how: http://ivanov.wordpress.com/2006/11/17/xml-to-html/[^]
Obviously, you'll need to get the transform file first, which means parsing the XML to get its location and downloading it after the XML has been received.
|
|
|
|
|
The calculation of the totals is done by the XSD, along with the layout.
You have two options: parse the XML and do the data manipulation that you need yourself (all the primary data is in the XML, i.e. all the information that is displayed can be generated from it), or use a XSD-capable library to turn the XML into HTML and then parse information out of that.
I'd go the first way: read that XML into a DataTable or a List<Generator> (some parsing code will probably be needed though if you set up your objects correctly you should be able to Linq-to-XML-load it), and then do grouping, totalling etc as you require.
|
|
|
|
|
I took the easy route which was to create a small forms application that used a WebBrowser object to render the page, then output the text stream from the WebBrowser to an email message. Not elegant but it works.
Thank you for all the replies.
Mark Jackson
|
|
|
|
|
I need to be able to access a number of certificates in a windows service. The code works fine in a console app, but from a service it can't find the certificate.
Is there a special way to install them and open them or both?
Any help would be much appreciated.
Happy programming!!
|
|
|
|
|
A service runs before the user logs in, hence it has to run under a different account. It's probably running under the system-account, and that has it's own profile.
Open the services, find yours, ask it's properties, go to the second or third tab, and have it run under the users' profile. That should do the trick
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I experienced the same problem when I set up Hudson for building our projects: signtool.exe did not find the certificate for signing our programs. I tried with certmgr.msc to make the certificate available for "local system", but failed. Now Hudson runs on my user account on that machine (see also Eddy's answer), and that works.
|
|
|
|
|
There are several MDI child form within my window, one of MDI child form after it's being launched will cause the focus mechanism to be weird, meaning a another MDI child window will not get the focus unless the title bar is clicked, clicking anywhere else in the mdi child form will not caused the form to focus.
any thoughts?
|
|
|
|
|
jojoba2011 wrote: one of MDI child form after it's being launched will cause the focus mechanism to be weird, meaning a another MDI child window will not get the focus unless the title bar is clicked
You mean that when you create and add a child, it is focused? Isn't that the default behaviour? Can you post some code, and explain a bit more on the behaviour that you expect, and how it is behaving now.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
jojoba2011 wrote: clicking anywhere else in the mdi child form will not caused the form to focus
This is weird, can you show us some code on how you show these MDI children?
|
|
|
|
|
Are you describing a scenario where, with the MdiParentForm:
1. one or more MdiChildForms are open and visible (not "collapsed"):
... and ...
2. you then create a new MdiChildForm and 'Show it: naturally it then has "focus," and is front of all other Child Forms:
... and ...
3. then you click inside the "client area" of a visible part of one of the other MdiChildForms that were already open:
... and ...
4. that already-open MdiChildForm you clicked in the client area of: does not: then: have "focus," and is not, now, in front of all the other Child Forms ?
If that is what you are describing: then, there's something very wrong with your code: because: the standard default behavior for clicking on any open (not collapsed) MdiChidForm, in its client area, or on its TitleBar, is: to give it "focus," and bring it in front of all other child forms that are visible.
The logical question to ask, I think, is: when you create a new instance of what will be an MdiChildForm: are you immediately setting its 'MdiParent property to your MdiParent Form ?
And now, excuse me while I get on my "soapbox" and tell you why I think you should not be using Mdi architecture in the first place:
1. it's outmoded, deprecated by MS, and allows the end-user to make visually confusing UI's.
2. even if both MdiParentForm, and MdiChildForm have their 'DoubleBuffered property set to 'true: when you drag a child form around by its TitleBar: you get just an outline of the Child Form.
3. you set the BackGroundColor of your MDIParentForm to some color: that setting is ignored, and you get a dark grey background. You gotta hack around to set its BackColor.
4. It's possible to drag your Child Forms so they are only partially in view inside the MdiParentForm.
So, what's better ? I suggest you consider: independently shown secondary Forms, or you use UserControls, or Panels, that you make movable by the end-user if that's required.
good luck, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
|
|
|
|
|
There is a program needed to display 32 road stream on its form, but I found that the display time delay is too hard. Is there anyone meet the similar problem?
|
|
|
|
|
With such a poor desciption of what you app is doing and a non-existant snippet of your rendering code, it's impossible for anyone to answer this question.
|
|
|
|
|
What is 32 road stream? Without this basic information, I'm afraid that I can't even begin to formulate an appropriate answer.
|
|
|
|