|
Why don't you register to the WebBrowser.DocumentCompleted event instead of actively waiting for the ReadyState property to become Complete .?
It's always complicated to access visual controls from threads other the one they were created on. Take a look at this article to get a general idea how to bypass. What's up with BeginInvoke?[^]
Furthermore the call of Application.DoEvents from a worker thread isn't necessary as the use of the worker thread already keeps your application responsive (in a much nicer way than DoEvents).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
bashiwala wrote: while(weBrowser1.ReadyState != RedyState.Complete)
Should that not be ReadyState.Complete?
|
|
|
|
|
May be the problem is using " Application.DoEvents()" in the delegate function. Using this method outside of the delegate function or DoWork method may be useful
|
|
|
|
|
Hello,
Let's say I have a variable named: someVar which contains the following:
href wow nice this <a href="cp.com">cow duck john</a> text etc
And I want to replace: "href" with "link". I can't do:
someVar.Replace("href", "link");
Because that will change: <a href="cp.com"> !
So, how can I replace all the occurances of "href" when it's not part of an HTML tag?
Please help.
|
|
|
|
|
hi
for something simple like that just try this:
someVar = someVar.Replace("<a href","|||||||").Replace("href","link").Replace("|||||||","<a href");
the ||||||| can be replaced by anything as long as it's unique
hope that helps.
|
|
|
|
|
Try this REGEX, I hope it will be useful. You can use any variable instead of link word in the following snippet.
string ResultString = null;<br />
try {<br />
ResultString = Regex.Replace(someVar, "(>.*?)(href)(.*?<)", "$1link$3",<br />
RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline);<br />
} catch (ArgumentException ex) {<br />
}
|
|
|
|
|
I was wondering if there is a way to detect if a process is executed, preferably with an event.
|
|
|
|
|
Hi,
You can easily create event handler for a process instance. IF you use Process Instance from Design mode, then you will see that, there is an event named EXITED available in the event list for that instance of component. If you are creating your process within your code, then you can use the following snippet.
........................................................................................<br />
<br />
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();<br />
myProcess.Exited += new EventHandler(myProcess_Exited);<br />
<br />
void myProcess_Exited(object sender, EventArgs e)<br />
{<br />
throw new Exception("The method or operation is not implemented.");<br />
}<br />
<br />
....................................................................................
|
|
|
|
|
I'm sorry but I should a written my question better, I need to run some code when a user runs a specific application on the computer, such as a game.
But thanks anyway.
|
|
|
|
|
i need to access a file in one form and print the contents of the file to the textbox which is in other form....
|
|
|
|
|
Use a delegate, or pass the form object of the parent to the child
|
|
|
|
|
My program edits text-based files full of nonsense.
I finally cleared up my program's commandline args thing to open a file by double-clicking on the file (with the appropriate made-up extension belonging to it).
However, when the user double-clicks on its file for the first time, and Windows asks the user what program to use to open the file (because Windows doesn't recognize the extension at first), my program has no name in the list! Please see this image:
http://electrobrainleonard.googlepages.com/unnamedProgram.png[^]
How do I get the dialog to have my program's name in it?
By the way, I use csc.exe directly to compile it.
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
try write values in AssemblyInfo.cs file, like AssemblyTitle().. and so on.
|
|
|
|
|
I added that line, but didn't see a change, so I started digging around in my registry. I simply modified the line that was already there:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]<br />
" program path here"=" program's title or name"
And now it works fine.
Thank you, though! I'm sure your way would have worked if I had done it in the first place and restarted or something...
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Dear Freinds,
I wanna make a program that take attaches from Micrsoft word file and send it as a fax through a Modem FAX
|
|
|
|
|
i dont actually know but what i used to do was to print the material with fax printer enable when configured - requires fax enable modem)
-- modified at 16:04 Monday 6th November, 2006
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
hi - i'm a newbie at c# programming for pocket pcs (mainly a c/c++ programmer)
i'd like to believe i've gotten the hang of it but some things still escape me
like i used the GZipStream to uncompress an http web response stream on the regular framework and it works fine - but when i move to the pocket pc it seems i am not allowed to create a GZipStream (the compression namespace is unavailable)
i'd appreciate any help anyone can give me
i want to achieve the same result in any way possible (if there is a simple algorithm i could just plug in then great - or a way to include the class then even better)
btw i have tried SharpZipLib and it didn't work (it threw an exception saying
"Error baseInputStream GZIP header, first byte doesn't match")
thanks so much to anyone who took the time to read this.
|
|
|
|
|
|
Hi,
I want to write some big text datainto wmv file(>64k). So I need the IWMHeaderInfo3 . I have the WMEncoder object. How to get IWMHeaderInfo3 interface from WMEncoder?
Regards,
Hemant.
|
|
|
|
|
Hi,
By calling Dataset.WriteXml, my code produces XML as listed below.
The user can also load the XML file, and I will use Dataset.ReadXML to do this. Preferably before calling that method, I would like to validate the schema of the XML to ensure that it has the same structure as an XML file produced by WriteXml. How can I do that?
At present, I am loading the XML file and writing code like this:
ValidXml =
(LoadedOk) &
(dsKeysAndValues.Tables[dsnKeysAndValues].Columns[KeyGroup] != null) &
(dsKeysAndValues.Tables[dsnKeysAndValues].Columns[ValueGroup] != null) ;
The code not only doesn’t work, but it also doesn’t seem elegant – if the XML file is large, it will take time just to load the file, before I can validate it.
How can I validate the schema of XML to ensure that it matches what I am expecting?
Thanks for your help, pointers, and time!
Richard
The mystery is out there – in the XML-Files (X-files music follows…)
XML produced using WriteXml:
<?xml version="1.0" standalone="yes"?>
<KeysAndValues>
<xs:schema id="KeysAndValues" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="KeysAndValues" msdata:IsDataSet="true" msdata:Locale="en-CA">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="KeysAndValues">
<xs:complexType>
<xs:sequence>
<xs:element name="Key" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Value" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<KeysAndValues>
<Key> K1</Key>
<Value> V9999</Value>
</KeysAndValues>
|
|
|
|
|
Take a look at the XmlValidatingReader class. It's obsolete in .NET 2.0 but the MSDN topic also provides links to topics that present you what to use instead.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi Stefan,
Thanks for your help.
Richard
|
|
|
|
|
Hi,
I want to convert a char array to System.IntPtr. How can I do this?
I written the following code wich gives error as cannot copy to null value
string metadatapath2 = "C:\\BigMetadata.txt";
StreamReader myStreamReader1 = new StreamReader(metadatapath2);
string bigdata = myStreamReader1.ReadToEnd();
char [] dataarray = bigdata.ToCharArray();
System.IntPtr myDataptr = new System.IntPtr();
Marshal.Copy(dataarray,0,myDataptr,dataarray.Length*2);
Thanks in advance
Regards,
Hemant.
|
|
|
|
|
You can't convert a char array to an IntPtr. An IntPtr is just a pointer in a form that can be handled by managed code.
What your code is currently doing is trying to copy the data from the array to the memory area that the pointer is pointing to. As you haven't allocated any memory area and made the IntPtr point to it, that is impossible.
What you have to do is to get a pinned memory area, either by allocating unmanaged memory and copy the data to it, or by pinning the dataarray, and make the IntPtr point to the memory area.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
Thanks for urgent reply.
How can I allocate a memry and get some data copy to that memory ad get its pointer back?
Regards,
Hemant.
|
|
|
|