|
If the XPath parameter passed to the SelectSingleNode() method does not include a prefix, it is assumed that the namespace URI is the empty namespace. If your XML includes a default namespace (and that is your actual case), you must add a prefix and namespace URI to the XmlNamespaceManager; otherwise, you do not get your node selected
So, replace your line:
XmlNode node = doc.SelectSingleNode("/configuration/appSettings");
with the following piece of code:
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);<br />
nsmgr.AddNamespace"pfx", "http://schemas.microsoft.com/.NetConfiguration/v2.0");<br />
XmlNode node = doc.SelectSingleNode("//pfx:appSettings", nsmgr);
SkyWalker
|
|
|
|
|
How to convert a Decimal number to Binary and Binary to Decimal.
Exp: 9 => 1001, 1001 => 9.
Help.
Vasildb
|
|
|
|
|
|
That project doesn't work because I have Visual Studio 2003.
Help.
Vasildb
|
|
|
|
|
It wouldnt be hard to make the project work on a more recent .NET/Visual Studio version.
Anyway, you do not actually need the project, just look in the code on how they do
conversions...
Luc Pattyn
|
|
|
|
|
I can't understand that, I a newbie.
Please tell me something easy for understanding.
Vasildb
|
|
|
|
|
http://www.is.wayne.edu/olmt/binary/page3.htm
Take a look at this site, it covers the conversion algorithm. It's really simple.
Just remember that binary numbers are powers of two, like that:
1101 = 13
read the binary number from right to left:
2 ^ 0 + | 1
0 ^ 1 + | 0
2 ^ 2 + | 4
2 ^ 3 | 8
_______
13
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Vasildb wrote: That project doesn't work because I have Visual Studio 2003
You should have mentioned it in your original post. Look at the code and get a general idea how to do the conversions or bump up to VS 2005...
|
|
|
|
|
Hope it's not too late!
private static Int32 BinStringToInt32(string value)
{
return Convert.ToInt32(value,2);
}
private static string Int32ToBinString(Int32 value)
{
return Convert.ToString(value,2).PadLeft(32,'0');
}
All the best,
Martin
|
|
|
|
|
I am working in C#.net and have a Datagrid control. The grid seems to work ok except for a new problem I have noticed.
When I resize the main form (and consequently the Datagrid) and scroll around the Datagrid using the forms scroll bars and then maximize the form and the Datagrid I notice that the Datagrid does not seem to repaint properly. The entire grid design is messed up.
I suspect this may be a repaint problem. Somehow and somewhere I need to force the grid to repaint.
I would appreciate any tips as to how and where I should do this.
Thanks, Vern
Vern
|
|
|
|
|
I can't really understand what your problem is, maybe you should be a little more clear on when the datagrid does not repaint itself correctly. As for HOW you can repaint it, datagrid.Invalidate(); should do the trick
Regards,
Vandra Akos
|
|
|
|
|
Vandra:
Thanks for the tip about the datagrid.Validate(). I put this in the Scroll event of the datagrid and this solved the problem I was having.
Let me try to explain the problem I was having again:
First I resize the datagrid so that the scroll bars show up. Then I scroll around the datagrid. Finally I resize the Datagrid so that it fills the screen. Now when I scroll again, the grid is messed up. Some columns appear twice, some don’t appear at all, its just really messed up.
Anyway, when I put the Datagrid.Invalidate() in the Scroll event, all is well.
Thanks again for your help.
Vern
Vern
|
|
|
|
|
i am trying to move a panel with:
pnlProgressBar.Location.X = pnlProgressBar.Location.X + 1;
for a progress bar. It is inside a while loop, but the following error occurs: "Cannot modify the return value of 'System.Windows.Control.Location' because it is not a variable"
I want it to later be able to actually show the amount of progress it has actually made, but first i need it to be able to move. If anybody else has a better way of making a progress bar that is only one bar, unlike the built in progress bar, please tell me. thanks in advance.
|
|
|
|
|
dsl/fahk wrote: Cannot modify the return value of 'System.Windows.Control.Location' because it is not a variable"
Location returns a Point structure. Point is immutable meaning once it has been created it cannot be changed. You have to assign a new Point to the Location property of the control.
|
|
|
|
|
Hello,
I would like to do what I call background printing. What this means is the user clicks a print button or a link to print a document without acutally having the document visible. I have searched the site for this and haven't found a posting covering this.
The only way I could think to make this happen would be to load the document in a hidden control and print from there. This seems kind of clunky and I was wondering if there was a more elegant approach.
Thanks in advance,
Eric
|
|
|
|
|
|
Why does this code give this error: "Specified cast is not valid"?
<br />
foreach(RadioButton r_button in groupBox2.Controls)<br />
{<br />
Console.WriteLine(r_button.Name.ToString());<br />
}<br />
|
|
|
|
|
Maybe you have something other than a RadioButton in groupBox2?
If so, try
foreach ( Control control in ... )
{
if ( control is RadioButton ) ...
}
|
|
|
|
|
Thanks!
This worked great!
<br />
RadioButton r_button = null;<br />
<br />
foreach(Control control in groupBox2.Controls)<br />
{<br />
if ( control is RadioButton )<br />
{<br />
r_button = ((RadioButton)control);<br />
Console.WriteLine(r_button.Text.ToString());<br />
}<br />
} <br />
|
|
|
|
|
|
Here's a more concise version that also performs better:
foreach(Control control in groupBox2.Controls)
{
RadioButton radioButtonControl = control as RadioButton;
if(radioButtonControl != null)
{
r_button = radioButton;
}
}
Last modified: 1hr 8mins after originally posted -- oops, meant to say != null there, thanks colin
|
|
|
|
|
The following line errors out.
<br />
RadioButton radioButtonControl = control as RadioButtonControl;<br />
I changed "RadioButtonControl" to RadioButton, but the if statement gives the following error.
Cannot implicitly convert type 'System.Type' to 'bool'
|
|
|
|
|
The if statement must evaluate to a boolean. The code you were given shows a mistake many developers that code in both C++ and C# make.
if (radioButtonControl != null)...
|
|
|
|
|
I don't know why I didn't know that, I use that all the time!
|
|
|
|
|
Colin Angus Mackay wrote: a mistake many developers that code in both C++ and C# make.
fixed
|
|
|
|