|
Timespan timespan = (dateTime1 - dateTime2);
timespan.TotalDays;
|
|
|
|
|
thank you
Nikesh Kr. Yadav
CSS Infotech
Sec- 31
Gurgaon,
Haryana(India)
|
|
|
|
|
np
|
|
|
|
|
hi,
how to read the following xml file in C#. Plz can any one help.
<record>
<student id="1">
<class> 5
<unit>5
<street> river street
<aa>
<bb>
<footballteam> MU
<student id="2">
<class> 10
<unit>1
<street> lake street
<aa>
<bb>
<footballteam> RM
Thanx and regards,
pls
|
|
|
|
|
You need to check 'Ignore HTML tags' in order to post XML. The answer is that the XmlDocument class or XmlDataDocument class will read this file, if it's on disc, or will accept it as a string. What I think you mean is, how do you access information in the file ? For that, you need to learn XPath, and the XML DOM. XPath is the language used to search for XML nodes, and the DOM is the standard interface that the aforementioned classes offer for searching, and modifying XML.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
- <record>
- <student id="1">
<Class>5</Class>
<section>Science</section>
- <Address>
<unit>5</unit>
<street>river street</street>
</Address>
<aa />
<bb />
<FootballTeam>MU</FootballTeam>
</student>
- <student id="2">
<Class>10</Class>
<section>Mathematics</section>
- <Address>
<unit>1</unit>
<street>lake street</street>
</Address>
<aa />
<bb />
<FootballTeam>RM</FootballTeam>
</student>
</record>
|
|
|
|
|
You are going to get errors using the example from your post. It has become unreadable.
Can you repost the XML, with the "Ignore Html tags in this message" enabled?
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
|
hi, I'm a beginner here. I've create an empty user control. I wish to allow a shape(rectangle, circle,etc) to be able to be drawn onto it. i got a function in the user control class:
void AddRect(Graphics shape,float x,float y)
{
shape.DrawRectangle(x,y,20,20);
}
in form class:
Graphics graph;
private Rectangle rectangle=new Rectangle(0,10,50,50);
graph = Graphics.FromImage(m_objDrawingSurface);
graph.Clear(SystemColors.Control);
ShapeCanvasl shape=new ShapeCanvasl();
shape.AddRect(graph,rectangle.X,rectangle.Y);
However, it draws on the form and not exactly on the user control. Any help is much appreciated.
Thanks
|
|
|
|
|
Imagine 2 GB of memeory map data and if user changes a bit we should be able to find the resultant change in the binary location update that specific byte.
Give me some larger memory based comparison APIs in .NET.
|
|
|
|
|
Depending on how you are implementing the interface to change the data it can be quite simple or very complex. If you do it like this:
public void ChangeData(int offset,byte newData) {
if(offset < 0 || offset > memoryMap.Size) {
throw new ArgumentException(offset);
}
memoryMap.Seek(offset,SeekOrigin.Begin);
memoryMap.Write(newData);
if(MemoryMapChanged != null) {
MemoryMapChanged(this,new MemoryMapChangedEventArgs(offset));
}
}
it's pretty simple to detect changes.
(memoryMap is a MemoryStream or a FileStream configured for read/write access)
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
Hi All,
I have completed writing a program in C#. It works fine. But my task is to execute it automatically at a prescribed time daily.
Plz let me know how to achieve this.
~Javid
|
|
|
|
|
You need to use the task scheduler. To schedule a task, you run the "at" command with the /every and time parameters. For instance
at 12:02PM /every:M,T,W,Th,Fr,S,Su "c:\myprograms\myProgram.exe" runs the program myProgram.exe every day at 12:02 PM. You can achieve a similar effect by setting up the command through the task scheduler.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Pete O'Hanlon,
Thank you for your reply. I thought of writing a program for it. Your reply made my life easier. I will try it.
~Javid
|
|
|
|
|
I have Winforms MDI application where forms contain TextBoxes and
DataGridViews.
Edit menu DropDownOpening contains:
private void editToolStripMenuItem_DropDownOpening(object sender, EventArgs
e) {
pasteToolStripMenuItem.Enabled = Clipboard.ContainsText();
}
DropDownOpening event does not fire.
Why ?
How to implement Edit / Copy, Paste, Cut items ?
Andrus.
Andrus
|
|
|
|
|
AndrusM wrote: DropDownOpening event does not fire.
Why ?
Impossible to say, we can't see where you hook it up, or when you expect it to fire.
AndrusM wrote: How to implement Edit / Copy, Paste, Cut items ?
Depends entirely on the data you want to cut/copy/paste, but mostly you move it between the clipboard and your application.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hey guyz how can i delete the temporary file that i created, whenever i retrieved the image saved in my database.. it keeps on growing..i hope u can help me regarding these...
here is the code
string strfn = Convert.ToString(DateTime.Now.ToFileTime());
FileStream fs=new FileStream(strfn,FileMode.CreateNew,FileAccess.Write);
fs.Write(imageByte,0,imageByte.Length);
fs.Flush();
fs.Close();
picBox.Image = Image.FromFile(strfn);
|
|
|
|
|
System.IO.File.Delete(...)
|
|
|
|
|
Hi,
FromFile keeps the file locked.
Replace the last line picBox.Image = Image.FromFile(strfn); by the following (approx):
Bitmap bm = Image.FromFile(strfn);
picBox.Image=new Bitmap(bm);
bm.Dispose();
File.Delete(strfn);
|
|
|
|
|
Could you not use a MemoryStream and Image.FromStream?
|
|
|
|
|
Consider my code below
Cursor m_OldCursor;<br />
void OnCursorChanged(object sender, EventArgs e)<br />
{<br />
if(m_OldCursor != null)<br />
{<br />
m_OldCursor.Dispose();<br />
}<br />
m_OldCursor = new Cursor(this.Cursor.CopyHandle());<br />
}<br />
<br />
void ProcessMouseMove(EventArgs e)<br />
{<br />
}
I know it is wrong to use a object after it is disposed. but every single
time the CopyHandle() method is invoked, it creates a handle. since there
is a restriction on the number of handles that windows can manage, i need
to dispose this handle after its use. if not then the application will
crash. If instead of Cursor, it was a control then i could have used the DestroyHandle property.
Could you suggest me any other way to do the same.
thanks in advance.
Keshav Kamat
India
|
|
|
|
|
Hi,
two comments:
1.
you should not try to dispose of cursors that you did not create yourself;
that's every Cursor you get from the Cursors class (the system created those, it
will dispose of them too when appropriate, and maybe never !)
2.
who is changing the cursor ? cant you do that with a simple method, something like (inside
your form class):
public static void SetCursor(Cursor newCursor) {
Cursor oldCursor=Cursor;
Cursor=newCursor;
oldCursor.Dispose();
}
no handles involved !
Hope this helps.
|
|
|
|
|
How to create pdf file from reading the data from the dataset and directly convert to the pdf file.
|
|
|
|
|
iTextSharp is a free .NET PDF extension. But even with it, writing pdf files in .NET is not very easy. There are some articles here on CP about iTextSharp, and also other free libraries, but most of them with limited functionality.
Search the "Articles" section.
GL!
|
|
|
|
|
Try CrystalReports... For creating PDF's its easy
|
|
|
|