|
No. It doesn't compile, it gives me an error saying that the method is undefined.
-Fred Morstatter
|
|
|
|
|
I am a beginner...i need to know how to write and read data in XML. Which is the data is use to create a graph...
|
|
|
|
|
You can just write it as a flat file, but if you want to interact with it using the DOM, use the XmlDocument class.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
Firstly add item->xml file and write the required details
For example:
<articlelist>
<id>1
<heading>Heading 1
etc.....
<by>Author1
<dated>January 05, 2007
<id>2
<heading>Heading 2
etc..etc....
<by>Author2
<dated>January 05, 2007
Now, to read this data the code would be as follows:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("path of the XML file")
XmlNodeList articleList = doc.SelectNodes("which data/node you want to access");
[example you want to access heading tag:ArticleList/Article/Heading]
//to display the nodes
foreach(XmlNode node in articleList)
{
Response.Write(node.InnerText.ToString());
}
**This way we can read the data from the xml file, we are using xmldocument, xmlpath in the above mentioned code...
Gautham
|
|
|
|
|
|
I was wondering how much use people make of attributes to implement "callback" like processing a'la OnDeserialized etc in NET2.0 serialization process.
I tried using OnDeserialized but it was happening too soon for my purposes, ie at the end of the DeSerialize process just before returning to the invoking method. What I needed was my [OnDeserialized] method be invoked after the object returned by Deserialize was put into the target. So I implemented a new trivial attribute [PostLoad] ("Load" being my term for Deserialization, and "Save" for Serialization).
The tricky bit was where to search for methods with the PostLoad attribute - I didn't like the idea of searching the whole assembly ? - but because the object graph was implemented as cascaded class, I only had to search down the nested class tree.
I also realised I could retain the list of methods I find, so the search is only performed once anyway.
|
|
|
|
|
pjd1001 wrote: I was wondering how much use people make of attributes to implement "callback" like processing a'la OnDeserialized etc in NET2.0 serialization process.
I used to think that metadata was the cat's meow. After using it extensively, I discovered that it leads to a maintenance nightmare. If you decide to change the attributes to a property, you have to recompile the whole assembly. Which, frankly, sucks. It would be much better if the metadata was external to the source code, so it can vary in a decoupled way from the code itself. Some people probably would not be happy with that idea. But that's my thoughts on the whole attribute thing.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
I'm not using the attributes to define metadata, or at least I don't think I am.
I give a method an attribute (e.g. [PostUpdate]), in the update process I look for methods with that attribute, if the parameters are the ones I provide then invoke the method - no adding methods to events, no OnBlahBlah methods - obviously not as granular as events (unless you prepared to have lots of attributes)
I thought refactoring was onselling the debts you bought at a discount
rgds phild
|
|
|
|
|
Guys I'm running out of ideas, I want to program something smart and creative so I can further advance my sqls
So far I did programs like:
Multi tab web browser (around web browser control)
Mulit tab editor (rich text box, xml, etc)... by far best thing I did 1200 lines of code in this one
Calculator (like standard win calc)
Some picture viewers both MDI and simple...
Some phone book program...
Student evidential program (take care about student data, massive use of inheritance, abstract methods, arrays, printing, etc).
Quad Media Player... can open 4 media files at once in one form... nice for comparing edited and unedited material...
Fahrenheit-Celsius converter with events...
and lot's of small things...
Now I want to do something on next level...
I don't want to involve much math in it... some level is fine... I want program to be usefull for something I do every day (or at least it's something someone would like to use every day)?
Any idea is welcome?;P
|
|
|
|
|
if you program every day, why not write something to help you do that.
I could do with something that generates UIEditors for complex objects eg
Dictionary<Guid, Dictionary<string, LinkedList<T>>> etc
that way you'll learn how to cope with restrictions imposed by existing infrastructure in this case the IDE.
|
|
|
|
|
Want to help me with this?[^]? It definitely qualifies as "something on the next level".
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Marc Clifton wrote: qualifies as "something on the next level"
Sound interesting but it's way ahead of one level up, I'm only doing c# for 2 months now... so maybe later who knows...
I guess I'll just stick with ADO.NET 2.0 for now... that is next thing I need to learn good I guess...
Still good ideas are welcome...
|
|
|
|
|
Lets say you have two text boxes, and you want to update one any time the other changes, regardless of which changes.
For example converting between Miles and Km.
How do you prevent the endless loop?
David Wilkes
|
|
|
|
|
Remove the event handler that listens for changes of the other textbox before you change its value and readd it afterwards.
"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
|
|
|
|
|
The XXXchanged events only fire when the value really changes, assigning a value that is
not different from the current value does not fire the event.
So it all boils down to the question: is my calculation numerically stable, i.e. will
it converge to a single value.
If yes (as with linear transformations, e.g. your unit conversions), dont do anything special.
If no (or unknown), break the loop explicitly (e.g. by removing and reinstalling one of
the event handlers).
The following example has two TextBoxes, showing a number and its square; for some of the
values (e.g. 50) it will take two iterations, but it always reaches a stable result:
public class CPTest_ChangedEvent: CPTest {
TextBox tb1=new TextBox();
TextBox tb2=new TextBox();
System.Windows.Forms.Timer timer=new System.Windows.Forms.Timer();
public override void Run() {
tb1.Text="1";
tb2.Text="1";
tb1.TextChanged+=new EventHandler(tb1_TextChanged);
tb2.TextChanged+=new EventHandler(tb2_TextChanged);
timer.Interval=1000;
timer.Tick+=new EventHandler(timer_Tick);
timer.Start();
}
private void tb1_TextChanged(object sender, EventArgs e) {
string s=tb1.Text;
log("tb1_TextChanged: "+s);
double i1=double.Parse(s);
double i2=i1*i1;
tb2.Text=i2.ToString();
}
private void tb2_TextChanged(object sender, EventArgs e) {
string s=tb2.Text;
log("tb2_TextChanged: "+s);
double i2=double.Parse(s);
double i1=Math.Sqrt(i2);
tb1.Text=i1.ToString();
}
private void timer_Tick(object sender, EventArgs e) {
string s=tb2.Text;
double i2=double.Parse(s)+1;
tb2.Text=i2.ToString();
if (i2>100) timer.Stop();
}
}
Luc Pattyn
|
|
|
|
|
or a flagging mechanism can be used here.
|
|
|
|
|
I had a similar problem while using a combo box and grid row updation.
Try using "SelectionChangeCommitted" event. This would be fired only when the control selection is changed explicitly by user.
|
|
|
|
|
Hi,
I have made a simple Windows Application in VS.Net C# which downloads the file from a FTP location.
Now, I want this application to run daily at 4:00 AM in the morning. What should be the solution to acheive this goal. Since its a very small code, so I can re-write the code if required.
Thanks in Advance,
Harjinder
|
|
|
|
|
You can do all sorts of things, like write it as a service, or just leave it running and set a timer which checks DateTime.Now and runs when your desired time has passed, then set a flag that resets after midnight.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi all,
i have the following problem then i use an timer
<br />
_timer = new System.Timers.Timer();<br />
_timer.Interval = 60000;<br />
_timer.Elapsed += new System.Timers.ElapsedEventHandler(StopRecording);<br />
_timer.Start();<br />
this calls the
<br />
public void StopRecording(object source, System.Timers.ElapsedEventArgs e)<br />
{<br />
this.m_FilterGraph.Stop();<br />
MessageBox.Show("FERTIG");<br />
}<br />
InvalidCastExecption does not handle by user code.
The Com-Objekt of Type "System.__ComObject" can not convert to interface "MVSmartControll.IMVSCFilterGraph2"
German full output:
Das COM-Objekt des Typs "System.__ComObject" kann nicht in den Schnittstellentyp "MVSmartControl.IMVSCFilterGraph2" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{3F7A5C55-B875-4ECE-BD28-843C3AE4628A}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)).
if i call this.m_FilterGraph.Stop() manual all works fine.
any idea how i can fix this ? so i read that the timer create an threadpool.
greeting gigo
|
|
|
|
|
Could it relate to the state of the variable when the timer goes off ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
Set a breakpoint on the timer, and see what the variable looks like there. Perhaps set breakpoints where-ever you change the variable, to establish order of operation.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I assume your COM component does not stand being called from different threads; I am
guessing you start recording from the UI thread, and stop recording by the timer
elapsed event, which runs on a thread pool thread.
If this is correct, there are basically two ways to fix it:
1) use Invoke to get the stop done on the UI thread
2) recommended: use a Forms.Timer instead of a Timers.Timer (so the tick event
automatically runs on the UI thread)
Luc Pattyn
|
|
|
|
|
I have a frame control that is running an external XAML file that contains a page.
I want to pass some options from the window that is hosting the frame control to the page running in the frame, how I do this?
what I have tried:
I assigned a reference to the tag property of the window. and then in the page onload(), I've tried to access it by using this.parent.tag, but the parent seems to be null.
maybe there is a better way... can anyone help me?
btw, why not create a different message board for .net 3.0 stuff like WPF, WCF, ... ?
thanks in advance,
Niko
<< Nearly all men can stand adversity, but if you want to test a man's character, give him power. >>
|
|
|
|