|
Aha! Now I read your answer it seems so simple, but of course it eluded me (maybe because I'm new at this!!).Thank you, Ennis. That makes sense and is most helpful. Have a good new year.
|
|
|
|
|
Hello,
My question may be very dumb but I couldn't change my web.config using the the following code:
XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
doc.Load(@"C:\Web.config");
XmlNode node = doc.SelectSingleNode("/configuration/appSettings");
I don't know why it always returns null.
Do you know what I stupidly did wrong?
Thanks,
Johnny
Here is my file
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="AuthorizationContext" value="Office" />
</appSettings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="abc" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<!-- Increase the timeout to 2 hours. -->
<httpRuntime executionTimeout="7200" />
<webServices>
<protocols>
<add name="AnyHttpSoap" />
<remove name="HttpGet" />
<remove name="HttpPost" />
<remove name="HttpPostLocalhost" />
<remove name="Unknown" />
</protocols>
<soapExtensionTypes>
</soapExtensionTypes>
</webServices>
</system.web>
</configuration>
-- modified at 20:25 Friday 29th December, 2006
|
|
|
|
|
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)...
|
|
|
|