|
<FXSpotRate code="EURUSD">
<values>
<value type="BID">1.3607</value>
<value type="ASK">1.3608</value>
<value type="MID">1.36075</value>
</values>
</FXSpotRate>
|
|
|
|
|
Something like this should work:
XmlDocument xDoc = new XmlDocument();
xDoc.InnerXml = @"<FXSpotRate code='EURUSD'><values><value type='BID'>1.3607</value><value type='ASK'>1.3608</value><value type='MID'>1.36075</value></values></FXSpotRate>";
XmlNodeList nodes = xDoc.SelectNodes("/FXSpotRate/values/value");
foreach (XmlNode xn in nodes)
{
//access the node info in here
}
Hope that helps.
Ben
|
|
|
|
|
Hi ,
I have two Applications , 1 being a Windows Service and the other one is a Windows Application . Both the Applications access an xml file which has to be modified under different scenarios .
I want to avoid concurrent updates /Reads on the xml file from both the application .
Tried using the ReadWriteLock for avoiding concurrent access on the file ,but it doesn't seem to work .
Kindly suggest how this can be achieved .
Thanks in Advance
Girija
|
|
|
|
|
CORRECTION:
Open the file as FileShare.None[^] (one of the sharing options) - that way nothing else will be able to open the file.
e.g.
FileStream stream = new FileStream("C:\MyFile.txt", FileMode.Open, FileAccess.ReadWrite, FileShare.None);
|
|
|
|
|
AFAIK the ReaderWriterLock is local to a process. You will have to use a named Mutex , that has system scope and thus can be shared between processes.
Regards,
Tim
|
|
|
|
|
Hello everyone,
I have a listview in my Windows Application which I wish to add some functionality to it's item. Since I wish the contextMenu to pop up only when an item is selected rather than anywhere in the area of ListView, I am using the following code:
private void listview1_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
ListViewHitTestInfo info = listView1.HitTest(e.X, e.Y);<br />
<br />
if (info.Item != null)<br />
{<br />
if (e.Button == MouseButtons.Left)<br />
{<br />
if (contextMenuStripListView1 != null)<br />
{<br />
contextMenuStripListView1.Show(listView1, new System.Drawing.Point((e.X + 15), (e.Y + 10)));<br />
}<br />
}<br />
}<br />
}
everything works fine if I use the LEFT mouse click to pop up the contextMenu as shown in above code. The problem appears once I change the left mouse click to RIGHT mouse click. Since I have another contextMenu which is assigned into the entire Form. I get the local contextMenu (The desired Menu) pop up first, then once I release the mouse I get the second ContextMenu (The undesired Menu) which is assigned to the form pops up. Is there anyway to disable the undesired contextMenu just in the area of listview?
OR should I use a different approach?
Thank you very much for your help and have a great day.
Khoramdin
|
|
|
|
|
Khoramdin wrote: Is there anyway to disable the undesired contextMenu just in the area of listview?
Since you are clearly controlling when-if the context menu shows for the listview I would imagine the same can be done for the form. Do you have a more specific question?
led mike
|
|
|
|
|
I have a MyDataSet : DataSet class which contains 3 talbes and 2 data relations. This is set to a custom datagrid which can expand to show something like Users -> tickets for user -> details of ticket. I'm sure this is entirely simple, but how do I sort while keeping my dataset as the datasource? When I google they always discard the dataset and do something like:
MyDataSet ds = (MyDataSet) _dgUsers.DataSource;<br />
DataView dv = ds.Tables[0].DefaultView;<br />
dv.Sort = "something ASC";<br />
_dgUsers.DataSource = dv;<br />
_dgUsers.DataBind();
This is useless as I've just lost my dataset. I tried modifying the view of the table inside the dataset but it just gets ignored (although it remains set when I sort again):
MyDataSet ds = (MyDataSet) _dgUsers.DataSource;<br />
DataView dv = ds.Tables[0].DefaultView;<br />
dv.Sort = "something ASC";<br />
_dgUsers.DataSource = ds;<br />
_dgUsers.DataBind();
How should it be done? When I clone the DataSet it seems to work. Why is that?
|
|
|
|
|
Perhaps you should try:
ds.Tables[0].DefaultView.Sort = "something ASC";
_dgUsers.DataSource = ds;
_dgUsers.DataBind();
Ben
|
|
|
|
|
That's what I did in the second code block. Doesn't matter if you touch the dg.DataSource or set it to a local variable as its a pointer to the same dataset object. Like I said, I would see "something ASC" set the next time I would sort. The code was there to toggle so clicking it you could see it going from ASC to DESC and back again. However, it did nothing. For some reason we needed to clone the dataset and set it back to the datagrid.
|
|
|
|
|
Hi
My UserControl does not look properly, I would like very much someone to help me adjusting it, it only paints well when it is a perfect rectangle otherwise it does not! I would like a panel with this look but when resized displays perfect as well
Here is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Extended;
namespace Teste17
{
public partial class UserControl5 : UserControl
{
public UserControl5()
{
InitializeComponent();
}
private void UserControl5_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush linearGradientBrush = new LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 45, false);
ColorBlend colorBlend = new ColorBlend();
colorBlend.Positions = new float[4];
colorBlend.Positions[0] = 0.00f;
colorBlend.Positions[1] = 0.49f;
colorBlend.Positions[2] = 0.51f;
colorBlend.Positions[3] = 1.00f;
colorBlend.Colors = new Color[4];
colorBlend.Colors[0] = Color.FromKnownColor(KnownColor.Window);
colorBlend.Colors[1] = Color.FromKnownColor(KnownColor.Window);
colorBlend.Colors[2] = Color.FromKnownColor(KnownColor.ControlDark);
colorBlend.Colors[3] = Color.FromKnownColor(KnownColor.ControlDark);
linearGradientBrush.InterpolationColors = colorBlend;
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
ExtendedGraphics extendedGraphics = new ExtendedGraphics(e.Graphics);
Pen pen = new Pen(linearGradientBrush);
extendedGraphics.DrawRoundRectangle(pen, 0, 0, this.Width - 1, this.Height - 1, 5);
}
}
}
The code of using System.Drawing.Extended; is from a friend here in codeproject which name I cannot remenber at the moment...
|
|
|
|
|
I suggest you abandon System.Drawing.Extended; it has some problems that are fundamental and honestly it's not that flexible.
If you're willing to download a larger framework, the most beautiful extended Panel I have ever seen comes from the Ascend.Net project:
http://www.codeplex.com/ASCENDNET[^]
Absolutely beautiful set of controls.
------------
Cheers,
Patrick
|
|
|
|
|
I have a form application that monitors a directory, reads new files and sends a query off to a web service. That is all that it does. When i build this app on my XP Pro laptop and run the executeable it works fine. If i take that same .exe and drop it on the XP server. When i double click to start it, i immediately get an error.
Common Language Runtime Debugger Services.
Appplication has generated an exception that could not be handled.
Process ID = oxa88(2696) Thread id = 0xaac(2732)
I know that that error message does not say much but i was wondering if anyone had any ideas for me to try???
|
|
|
|
|
You should try creating a setup kit and install it on the server. Copying the exe file will not help, unless you have the framework installed on the server and all the dependencies with the exe are copied in the required folders on the server(which is tedious).
|
|
|
|
|
Hi,
I am using Visual Studio 2005 for my projects.
I am getting empty Properties Window. and ToolBox Window.
So, I am not able to create any controls and change their Properties.
But i am able to run the application.
Please Tell me What is the Problem. I am new to Microsoft .Net.
With Thanks,
Sakthi.
|
|
|
|
|
You don't add controls from the properties window, but from the toolbox. The properties window is empty when you're looking at code, it's only valid when you're in design view.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Hi,
First of all, i am getting empty toolbox.
Even if i use choose items to add in Toolbox,there is no components for
adding.
I am working on Microsoft from the past 3 months.
When i opened my earlier Window Application Projects, its working Fine.
Only thing is ,When i tried to modify the properties for the control,
Its empty. Still i am able add and modify controls manually.
With Thanks,
Sakthi
|
|
|
|
|
This happened to me before.
Close VS.NET, restart your computer and try again.
That seemed to work for me.
|
|
|
|
|
Thanks Marky
Its going Fine After i restart my machine.
did you figure out the problem.
Sakthi
|
|
|
|
|
1 of my mottos: if all else fails, just restart...
|
|
|
|
|
Properties , Toolbox windows are displayed in the design mode only
if you are at the design mode and those windows dont appear too , display them from View menu
Amr Abdel-Mohsen Hafez
Software engineer
Cairo
E g y p t
|
|
|
|
|
hi
i want to create ThreadStart object and pass to it a method with a string parameter, but how to do ? please give an example by code. thanks
|
|
|
|
|
I think it is not possible in C#, only methods without params.
All the best,
Martin
|
|
|
|
|
All the ways of starting a thread I know of, have a version which takes an object as a param. It needs to be cast on the other side into what ever you expect it to be.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Hello,
If you are using the ThreadStart class and "void()" as parameter, there is no way to add a param for the method, I think.
Second Constructor of ThreadStart takes object and IntPtr as params. (never used it)
All the best,
Martin
|
|
|
|