Click here to Skip to main content
16,016,425 members
Home / Discussions / C#
   

C#

 
GeneralRe: Application Focus Pin
Kayess Tech28-Apr-06 0:26
professionalKayess Tech28-Apr-06 0:26 
Questionspeech marks in the registry key Pin
IAmChris26-Apr-06 11:10
IAmChris26-Apr-06 11:10 
AnswerRe: speech marks in the registry key Pin
likefood26-Apr-06 11:16
likefood26-Apr-06 11:16 
GeneralRe: speech marks in the registry key Pin
IAmChris26-Apr-06 11:42
IAmChris26-Apr-06 11:42 
QuestionClip Rectangle - Cursor Pin
codebala26-Apr-06 10:57
codebala26-Apr-06 10:57 
AnswerRe: Clip Rectangle - Cursor Pin
Ed.Poore26-Apr-06 11:53
Ed.Poore26-Apr-06 11:53 
QuestionHelp require on transfering sms and video(MMS) from pc to mobile using SIP protocol Pin
kashif.qau26-Apr-06 10:41
kashif.qau26-Apr-06 10:41 
QuestionHtmlElement.OuterHtml.Replace(­) fails with COM exception Pin
cweeks7868126-Apr-06 10:28
cweeks7868126-Apr-06 10:28 
I've tried asking this on microsoft.public.dotnet.languages.csharp, but I am getting no response. Maybe I'm getting lost in the traffic. So, let's try it here.

Dev env: VS 2005 C# Express, .Net Framework 2.0

I am trying to programmatically select an item in a listbox on a web page. The first thing I do is go through and de-select any selected items. The OuterHtml field of a selected element in the listbox looks something like this:

Default item

I want to simply remove the the term 'selected' this way:

elt.OuterHtml = elt.OuterHtml.Replace("selected","");

This results in OuterHtml being set to:



Notice: 1) the 'selected' term is untouched, 2) the visible text has been removed.

After the assignment I can see in the debugger that one of the members of the HtmlElement object (OffsetParent, I think) has a string indicating some kind of COM Interop services exception.

The MSDN documentation at

http://tinyurl.com/edbln

does contain this warning:

"If you assign a new value to OuterHtml, the current element reference will become invalid; it will not reflect the name, properties and child content of the HTML you have just assigned."

but I don't really understand what that means.

Is it possible to change the HTML in a web page? Am I going about it the wrong way? Is there some kind of initialization or setup call I am supposed to make? Is it just a bug in .NET 2.0?
GeneralRe: HtmlElement.OuterHtml.Replace(­) fails with COM exception Pin
Guffa26-Apr-06 10:39
Guffa26-Apr-06 10:39 
GeneralRe: HtmlElement.OuterHtml.Replace(­) fails with COM exception Pin
cweeks7868126-Apr-06 10:49
cweeks7868126-Apr-06 10:49 
QuestionHow to read a file that is always written to? Pin
pistolenpaultje26-Apr-06 10:17
pistolenpaultje26-Apr-06 10:17 
AnswerRe: How to read a file that is continuedly written to? Pin
Guffa26-Apr-06 10:32
Guffa26-Apr-06 10:32 
GeneralRe: How to read a file that is continuedly written to? Pin
pistolenpaultje26-Apr-06 10:43
pistolenpaultje26-Apr-06 10:43 
GeneralRe: How to read a file that is continuedly written to? Pin
Ed.Poore26-Apr-06 12:30
Ed.Poore26-Apr-06 12:30 
AnswerRe: How to read a file that is continuedly written to? Pin
Office Lineman26-Apr-06 10:39
Office Lineman26-Apr-06 10:39 
GeneralRe: How to read a file that is continuedly written to? Pin
pistolenpaultje26-Apr-06 10:58
pistolenpaultje26-Apr-06 10:58 
GeneralRe: How to read a file that is continuedly written to? Pin
likefood26-Apr-06 11:31
likefood26-Apr-06 11:31 
GeneralRe: How to read a file that is continuedly written to? Pin
pistolenpaultje26-Apr-06 11:39
pistolenpaultje26-Apr-06 11:39 
GeneralRe: How to read a file that is continuedly written to? Pin
likefood26-Apr-06 11:54
likefood26-Apr-06 11:54 
AnswerRe: How to read a file that is always written to? Pin
CiNN26-Apr-06 16:33
CiNN26-Apr-06 16:33 
GeneralRe: How to read a file that is always written to? Pin
pistolenpaultje27-Apr-06 12:46
pistolenpaultje27-Apr-06 12:46 
QuestionC# Express Edition - Deployment Pin
econner26-Apr-06 10:05
econner26-Apr-06 10:05 
AnswerRe: C# Express Edition - Deployment Pin
Ed.Poore26-Apr-06 11:59
Ed.Poore26-Apr-06 11:59 
GeneralRe: C# Express Edition - Deployment Pin
econner26-Apr-06 12:08
econner26-Apr-06 12:08 
GeneralRe: C# Express Edition - Deployment Pin
Ed.Poore26-Apr-06 12:27
Ed.Poore26-Apr-06 12:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.