|
|
I'm not shure if I am able of writting down my own parser. Also I tryied out the library you suggested, but could not use it. I imported the dll file and still din't manage it. I'm new in programming and have not enough experience. Could you please help me out here??
|
|
|
|
|
|
I am looking for an efficient method to synchronize my forms. In my application I have a class named "FormContext " where singleton properties of available forms are present. These are lazily loaded. Assume I have two windows open (first window is not visible as it's on the back), I need to synchronize the forms state and size when any of the form resizes. All my forms are inherited from a class called "BaseForm ". For synchronizing, this is what I did,
1 - Created a static event in the FormContext class say BaseFormResized
2 - Hooked this event when each form starts
3 - In the "BaseForm"s resize event, I am calling this event to synchronize the other forms.
This method is working, but the forms are flickering and I am unable resize it by dragging it. Is there any other efficient method available to keep the forms synchronized ?
|
|
|
|
|
Sounds like your getting stuck in a infinite loop.
If each form is responding to BaseFormResized events and resizing themselves to match, that will trigger another resize event, which the form will again respond to...etc...
When you respond to the BaseFormResized event, first check if form is already the correct size. If it is, then don't do the resize. This will prevent a second resized event getting triggered, so hopefully you won't get the loop.
If this doesn't work, post some code so I can see what's going on.
Simon
|
|
|
|
|
hi all,
i am using .net 3.0.and iam working on c#.i want to add background music for my asp.net application when it is viewing in browser.can anyone help me
|
|
|
|
|
1 - This is wrong forum, choose web developement forum instead
2 - This has nothing to do with ASP.NET. ASP.NET processes the markup and sends HTML back to browser. It can't play music. This is done with HTML
3 - Learn to google[^]
|
|
|
|
|
I am using VS 2003 for my current project.I am supposed to use Datagrid with checkbox columns in my project ,but that one is not in VS2003.Is there anyway to use VS2005 Datagrid in VS2003...
|
|
|
|
|
Nope. AFAIK, there is no way to do this
|
|
|
|
|
No, you can not use classes from .NET 2.0 in your .NET 1.1 app.
|
|
|
|
|
Nope. Also don't use bold text and don't expect too much help. We know who you are Subin Raju, and the level of abuse you hurled at Paul Marfleet when he tried to help you. Now, unlike you, I will be polite to people on these forums but not to a berk like you.
|
|
|
|
|
How to write a while loop?
oooo
|
|
|
|
|
As it is written in any other programming language.
rahul
modified on Thursday, April 3, 2008 7:30 AM
|
|
|
|
|
while()
{
}
Now, buy a beginners book on C#!
|
|
|
|
|
Hi,
bool I_need_programming_info=true;
while(I_need_programming_info) {
Book tutorial=BuyBook();
StudyBook(tutorial);
Book reference=BuyBook();
StudyBook(reference);
string guide=@<a href="http://www.codeproject.com/KB/tips/HowToUseGoogle.aspx">"http://www.codeproject.com/KB/tips/HowToUseGoogle.aspx"</a>;
BrowseAndRead(guide);
GoogleAround();
ReadDocumentation();
}
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
One of the best pieces of code I've seen in a while
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
I may be being a little pedantic, but wouldn't a do...while loop be better so he has to execute those instructions at least once?
Dave
|
|
|
|
|
Hi,
sure do ... while() can be useful, although I seldom use it, under most
circumstances I prefer for(; ; ) , often with one or more explicit exit tests.
However those may be topics for a more advanced thread, and since the OP asked for a while
loop explicitly I wanted to keep it as simple as possible. Besides, assuming some
perseverance, the given algorithm will teach him all the other loop constructs too.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I've never used it actually.
I just thought
Book tutorial=BuyBook();
StudyBook(tutorial);
Book reference=BuyBook();
StudyBook(reference);
string guide=@"http://www.codeproject.com/KB/tips/HowToUseGoogle.aspx";
BrowseAndRead(guide);
GoogleAround();
ReadDocumentation(); should be executed at least once
Dave
|
|
|
|
|
Actually it needs to get executed forever, since people forget and technology evolves.
And my while loop takes care of that, the condition is always true.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I have a little issue with some code I'm doing. Basically I have a source xml document that looks like this:
<Paragraph>This is a <Emphasis Type="Bold">test</Emphasis> line with these:<List><Entry>Keyword alpha</Entry><Entry>Keyword Bravo</Entry></List></Paragraph>
and the problem is this, if I wanted my code to tag a specific word for example replace the word alpha with
<Emphasis Type="Italic">alpha</Emphasis>
to create this new node:
<Paragraph>This is a <Emphasis Type="Bold">test</Emphasis> line with these:<List><Entry>Keyword <Emphasis Type="Italic">alpha</Emphasis></Entry><Entry>Keyword Bravo</Entry></List></Paragraph>
is there a way of identifying a specific point in the overall line to correctly replace it, given that the word alpha could conceivably appear before or after the instance to be tagged?
At the moment I am attempting to use a function that pulls the Paragraph Node to text (innertext) and clears out everything after the required word and then starts to create a new string builder by individually pulling innerxml of each node until the patterns match.
To me this is incredibly convoluted, is there a better way?
|
|
|
|
|
You could use richTextBox to view the text. Then you can use some of the controls of this richTextBox to get the current position or better the selected text and add your tag in the begginig of the selection and the close tag at the end of the selection, and save it.
|
|
|
|
|
Thanks for the reply I appreciate the information.
The text is already displayed in a RichTextBox object but without the tags, that is to say the user sees XmlNode.InnerText. Indeed the position of the selection is recorded and used but the problem is that if there are other tags in the root node, or the word is nested then I'm finding it impossible to relate the position from the plain text back to the correct position in the InnerXml
|
|
|
|
|
If you read an XML document into a big honkin' string you can simply use Replace()
Or Notepad --Added
Krippers wrote: To me this is incredibly convoluted, is there a better way?
I'm still trying to figure out what the question is...
Are you asking how to find the XmlElements in an XmlDocument that contain certain text?
Or how best to make the replacement once you've found one such XmlElement?
I wrote the following on the assumption that it is the latter...
Provided you loaded the document into an XmlDocument, you can enumerate the Entry elements to find the one(s) you want to affect.
I just noodled about and wrote:
System.Xml.XmlDocument doc = new System.Xml.XmlDocument() ;
System.Xml.XmlElement ele ;
doc.AppendChild ( ele = doc.CreateElement ( "Test" ) ) ;
ele.InnerText = "Keyword alpha" ;
string[] temp = ele.InnerText.Split ( new char[] { ' ' } , 2 ) ;
ele.RemoveAll() ;
ele.AppendChild ( doc.CreateTextNode ( temp [ 0 ] + " " ) ) ;
System.Xml.XmlElement nod ;
ele.AppendChild ( nod = doc.CreateElement ( "Emphasis" ) ) ;
nod.InnerText = temp [ 1 ] ;
The result:
<Test>Keyword <Emphasis>alpha</Emphasis></Test>
You didn't make the requirements very clear so I chose your simpler example.
You may need to use a Regular Expression to split the InnerText.
Or perhaps you could use XSLT to perform the change.
modified on Thursday, April 3, 2008 1:28 PM
|
|
|
|
|
Hi, and thanks very much for the reply I appreciate the effort. That all looks good and I can see it working but I'm probably going to have an issue with multiple instances of the required word in a nested tree. Let me show you what the situation could be:
Source Document:
<Manual>
<Chapter>
<Paragraph>In the beginning I had a car</Paragraph>
<Paragraph>It was a <Emphasis Type="Bold">fast</Emphasis> car</Paragraph>
<Paragraph>The dashboard had: <List><ListItem>Lights</ListItem><ListItem>Dials</ListItem><ListItem>Dashboard</ListItem></List> on the Dashboard</Paragraph>
<Paragraph>I like fast cars and I like their dashboards.</Paragraph>
</Chapter>
</Manual>
What the user actually sees is a richTextBox output of each Paragraph element.
User view:
<manual><br />
<chapter><br />
<paragraph>In the beginning I had a car</paragraph><br />
<paragraph>It was a <emphasis type="Bold">fast</emphasis> car</paragraph><br />
<paragraph>The dashboard had: <list><listitem>Lights</listitem><listitem>Dials</listitem><listitem>Dashboard</listitem></list> on the Dashboard</paragraph><br />
<paragraph>I like fast cars and I like their dashboards.</paragraph><br />
</chapter><br />
</manual>
If the user selected the third Dashboard on the third line then would that be an issue to the code you provided?
Many thanks for the help.
|
|
|
|