|
In my Winapp there are a web browser control(axWebBrowser1) and two button control(Load and Save),First i load file(suppose 1.htm) to axWebBrowser1 then when i save it's content there is a exception said the Process can not visit the file because another application is using the file.
Why? How can i get rid of it?
|
|
|
|
|
above question is bring forward by me.
here is the button click
private void save_Click(object sender, System.EventArgs e)
{
UCOMIPersistFile file = (UCOMIPersistFile)axWebBrowser1.Document;
file.Save(Application.StartupPath+"\\temp.htm",false);<----Exception
}
private void button2_Click(object sender, System.EventArgs e)
{
object oEmpty =null;
axWebBrowser1.Navigate(Application.StartupPath+"\\temp.htm", ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}
|
|
|
|
|
It sounds like you cannot change the file because something has a lock on it - possibly your own program.
First be sure to close the file stream (don't just rely on it falling out of scope to close it). Also do a try-catch-finally block around the save, so you can attempt to clean up your file object properly even on the exeception.
If that doesn't work try to not load up the document in your browser control. Just save it and try opening it up in IE. Then keep it open and try saving again. That way you can see if it's your application in particular that is locking the file or something else.
/**********************************
Paul Evans, Dorset, UK.
**********************************/
|
|
|
|
|
why use below sentence don't appear exception:
private void button2_Click(object sender, System.EventArgs e)
{
object oEmpty =null;
axWebBrowser1.Navigate(Application.StartupPath+"\\temp.htm", ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
((IHTMLDocument2)axWebBrowser1.Document).designMode="On";<---Add only
}
|
|
|
|
|
I want to give a special color to any item of what we see on the screen and not all the content of the richTextBox.
So I need to know any time the index of the first and last char we see in the richTextBox (regardless of the way that screen changes eg. trackpoint of a notebook)
Is it possible to know that ?
|
|
|
|
|
You can use GetCharIndexFromPosition() to determine the index of the character closest to a Point you supply.
For the first visible character this would be the top left corner of your RichTextBox and the last character can be found by supplying the lower right corner's coordinates.
mav
|
|
|
|
|
|
I got a problem with a Isnumeric I'm using. I keep getting the error. "Not all code paths return a value" Please help. Heres the code.
public bool IsNo(char[] test)<br />
{<br />
foreach(Char chrMine in test)<br />
{<br />
if (chrMine >= '0' && chrMine <= '9')<br />
{<br />
return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
<br />
}<br />
<br />
<br />
}
Thanx
|
|
|
|
|
What happens if the foreach loop contains nothing to loop over? What is returned in that instance?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
u have specify what has to be retured if both the if and else condition fails. so if u say return true or false as the last line then you wont get this error.
Regards
GP
|
|
|
|
|
Thanx guys, got it sorted :P;)
|
|
|
|
|
Even "Not all code paths return a value" does not appear
this does not make the work you want
Try this :
public bool IsNo(char[] test)<br />
{<br />
foreach(Char chrMine in test)<br />
if (chrMine < '0' || chrMine > '9')<br />
return false ;<br />
return true ;<br />
}
|
|
|
|
|
hi,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconnon-blockingserversocketexample.asp
im developing an tcp server that borrows heavily from the above sample (added a GUI)
and my problem is, i dunno how to stop the server (without terminating the entire program)
thanks
|
|
|
|
|
hi,
when the client (ppc emulator) sends a multipart POST to the server (running on the same PC) , there are problems quite often.
sometimes it says "Unable to read data from the transport connection." and sometimes the server receives the HTTP header only.
here is my code segment,
WebRequest request;
Stream requestStream;
try
{
request = HttpWebRequest.Create(url);
request.ContentType = "multipart/form-data; boundary=" + boundaryString + "\r\n";
request.ContentLength = message.Length;
request.Method = "POST";
request.Timeout = 7000;
requestStream = request.GetRequestStream();
requestStream.Write(message, 0, message.Length);
// Close the Stream object.
requestStream.Close();
// 1. Get the Web Response Object from the request
WebResponse response = request.GetResponse();
// 2. Get the Stream Object from the response
Stream responseStream = response.GetResponseStream();
// 3. Create a stream reader and associate it with the stream object
StreamReader reader = new StreamReader (responseStream);
// 4. read the entire stream
results = reader.ReadToEnd();
reader.Close();
responseStream.Close();
}
catch(WebException webEx)
{
results = "An exception occurred relating to the use of " +
"a web response or request object. The specific exception was:" +
webEx.Message;
}
//Did some type of general exception occur?
catch(Exception ex)
{
results = "A general exception occurred while attempting to " +
"retrieve the requested page." +
ex.Message;
}
thanks
|
|
|
|
|
Hi, how to query memory consumption of...:
a. Hashtable, and the stuff which is housed in it.
b. Current thread
c. Current process
and to retrieve the information programmatically. Thanks a bunch!
Norman Fung
|
|
|
|
|
i have finished a project in c#,i use in the project access database,so when i try to run the program in any other machine..an error message appeared
.NET Data OLE DB provider(System.data.oleDb) requris Mircrosoft Data Access Copmonent (MDAC) version 2.6 or later
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
|
|
|
|
|
Hello!
I only think that I know your problem, so don´t worry if I´m wrong!
I think MDAC 2.6 is needed. This is a microsoft product for Windows and it´s downloadable at microsoft homepage.
After installation I think it work´s.
But this all are only suggestions and I don´t give any guarantee.
Ciao
Norman-Timo
|
|
|
|
|
hi
please try to use Microsoft Data Access Component 2.7 or latest.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Hi Friends
Here is a simple question in which im confused.
when we build our ASP.NET project . Does it get compiled or gets interpreted.
I know that many of us think that it is compiled but when i build my project i get the error one by one.
this means that it is interpreted.
If any one knows what is this please do let me know.
Naveen
|
|
|
|
|
ASP.NET is compiled. This is most obvious if you are using code behind files. If you are embedding C# code into the aspx pages then the first time the page is encountered .NET will compile the C# in to an assembly and this may look as if it is interpreted if you get the errors "one by one" as you navigate through your site - however it is all compiled on the fly and a second visit to the same page will not trigger the compilation process unless the ASP.NET process realises that the aspx page has changed.
Alternatively, you could just be seeing normal runtime errors. However, as you say "when i build my project i get the error one by one" that suggests that you are getting compile time errors, but every time you correct one it unhides another.
If you need more help then you need to explain how you've built your application and what errors you are getting and exactly where they are occurring.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
hi,
anybody knows how to get the internal IP of a ppc after establishing a connection with the desktop thru activesync??
coz im developing an application that the desktop has to send sth to the device thru TCP
thanks
|
|
|
|
|
Your question would be better handled in the Embedded/Mobile Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm not too sure how to say what I would like consisely but here goes:
If my program is doing a somewhat cpu intensive process, I would like a threaded progressbar to come up, and give an intication of how long the process will take, then once finished hide itself again and the program continues. I can make the progressbar already, as well as thread it.
All I want to know is how to invoke it. ie how to find out if the process I'm running warrants the bar or not. Any ideas?
|
|
|
|
|
That would depend on the process your running, and would normally be determined by the process, not the part that launched it.
The process would have to be able to determine the amount of data that must be processed AND track where it is currently. For example, searching through an unknown number of files would not lend itself to a progress bar because you can't determine when the progress is going to end. But searching through a known number of files will. All you have to do is keep track of the number of files you've searched through.
The process would also have to implement a timer where if the process is still running after say, 3 seconds, the timer would set a flag that shows a dialog with the current progress information. This progress tracking would be running regardless if the dialog was showing or not. The timer is only there to flip on the display of the progress, not to start it.
If you're trying to track the progress of a component you didn't right, there is not much you can do to implement the progress bar. Your component must be able to tell you how much processing must be done and how far along it's gotten. It must also be able to fire off events on some condition that lets you know progress is being made. If you component doesn't give you any kind of information like this, your SOL.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just can't seam to figure out why the following code is not working. I would be thankful for any help.
Thanks,
JefferyS
CODE:
string folderPath = "C:\\My Documents\\Visual Studio Projects\\MyDroidEngineer\\Data\\";
DataSet myDS = new DataSet();
myDS.ReadXml(folderPath + "planets.xml");
cboPlanets.DataSource = myDS.Tables["planet"];
cboPlanets.DisplayMember = "description";
cboPlanets.ValueMember = "swgcraft_id";
I get no errors and just a blank combo box
I have used a temp datagrid to check the dataset and it displays correctly.
Top Part of XML File:
<planet_data>
<planet swgcraft_id="1">
<description>Corellia
<planet swgcraft_id="2">
<description>Dantooine
<planet swgcraft_id="3">
<description>Dathomir
|
|
|
|