I've been linking to an external config file using <appSettings file="blah"> since VS 2003. I just created my first 2010 project, and I get no data from my file, nor any error. [edit]This functionality works as expected when I point to 3.5 framework.Another note, if I copy the other config to the debug directory and reference it by file name it works. When I use the UNC path it doesn't. The UNC path has worked for many of my past projects. Maybe it's a 4.0 security setting somewhere?
I have built a functionality where I want to back up the database - [Access]. Currently, its working but the user has to specify the file. I used a FileOpenDialog Box to get the file, saved it in a textbox and copied it to another directory. That works good. What I want now is the user doesnt have to know the lcoation of the Database. So, I just want to copy the Database File using the Configuration.Appsettings. He can specify the directory the file needs to be copied to. The Access DB is referenced as follows:
I get an error when I try to build my project.'SSLAccessFiltercannot' be used as an attribute because it does not inherit from 'System.Attribute'. [code]
I have a userControl that I made, and it was placed on a form with other controls.On the form I pass the values from the other controls to a Function inside the userControl, this then takes the values passed in and the values on the userControl to make and return an object.
The Problem is that when it gets down to '.GameOppScore = OppScore' it decrements .GameScore by 1 and then decrements .GameOppScore by 1. It does nothing to the passed in values or the value in the input text box.
It just randomly decides to -1, I walked through the code while running and couldn't find a reason why it would do that.
I have a custom Attribute class where the constructor takes one fixed parameter and two optional parameters. It is my understanding that one can supply one or more optional parameters by using 'named parameters' such as this:
Private Sub CallMethod() Me.OptionalMethod(-1, z:=1) End Sub
[code]....
Well, I thought, perhaps Attributes don't support named parameters. I know they can behave a little weird (they don't support all types in their arguments for example I think), so I thought little of it.But then... I noticed something else. If you take a look at my code of the attribute class again. Notice that I am using an attribute on that class as well... And what do you know: named parameters. Working just fine... The AttributeUsage attribute has the exact same configuration: one fixed parameter and two optional parameters. I seem to be able to call them using named parameters just fine, where I cannot call my own attribute constructor with named parameters...
Public Shared Readonly property AppSettings() As 'System.Collections.Specialized.NameValueCollection'
[code]....
I tried to replace the old method with the new one, but it does not exist.Strange, since I've done a similar thing with a web app and it did exist there.
This is my Effect.xml file .I am using vb.net to access this xml file. Actually i want to access effect name when i enter particular effect id.So that i will get attribute value of effect name when i give effect id as input value How can i do using vb.net
I have an app that reads the file attribute to determine if it is normal, readonly or archive. Nowhere can I find the numerical values that equate to normal, readonly or archive, however I have debugged & found that archive is 32. The files on the cd are 33, what type of attribute is this and where is a list of all numerical values that equate to a file attributes type?
I am building a tool that takes an XML document and replaces XML nodes with a different XML node using .ReplaceChild. This all works great. The nodes get changed to the proper nodes. Where I seem to be having an issue is that the new node is inserted with an xmlns="" attribute, which I am not specifying for it to do, nor do I want as an attribute. How can I stop the ReplaceChild from inserting this as an attribute, or am I going to have to remove the attribute after the node is replaced?
Dim imgSrcNode As XmlElement = xmlDoc.CreateElement("img") Dim imgSrcAttr As XmlAttribute = xmlDoc.CreateAttribute("src") imgSrcAttr.InnerText = "./art/" + imageName.Substring(0, imageName.LastIndexOf(".")) imgSrcNode.Attributes.Append(imgSrcAttr) mmlNode.ParentNode.ReplaceChild(imgSrcNode, mmlNode)
Resulting XML change: <img src="./art/equJI161298_1" xmlns="" />
XML change desired: <img src="./art/equJI161298_1" />
I have a list of objects, each object has a score attribute,The list of scores needs to be combined on the player ID to become a totaled score or series. My current thought process is to For Each through the list of individual games, and add the score attribute to a new list of scores with the same objects. So one list would be like:
clsGame(ID Number, Sore) dim ScoreList as list(of clsGames) ScoreList.Add(New clsGame(11, 244) ScoreList.Add(New clsGame(11, 333) ScoreList.Add(New clsGame(11, 444)
Then go through combining on like ID's to make a new list of games, that would actually be the series.
Dim SeriesList as new list(of clsClasses) For each game as clsGame in ScoreList 'cycle through the list of series seeing if an ID matches, if so add the score onto that ID Else
[code]....
Now I don't know how to add the player if its not in the seiries list without doing a heck of a lot more for each statements. If I add it after the end if then it will be added even if it is in the list..I tried playing around with List.Contains method, but I could only see if it contaned the exact same values i.e
SeiresList.Contains(game)
and because the scores are different (series vs single game) it wouldn't match, and I don't know how to see if it contains an object with just one of the attributes the same...
I have a webbrowser control with a static HTML page in it, i wanted to loop through each of the DIV items, and look at the class attribute within them. When i run my test, the class attribute is always blank? I know they have a class attribute i checked in my HTML
What is the purpose of the <Clear > XML element within the <AppSettings> tag in an application's config file?I see it removes previously added settings (see code below), but why would you want to do that? [code]I also understand that when manipulating app settings in code you could clear existing keys, but why have the <clear> XML element?Also, out of habit really, i've been putting the <clear> element before any <add> elements. Do i need to do this, should i not be doing this?
I am trying to read through a bunch of sub directories checking to see if the archive bit is set on any file and if so then I intend to create a zip file of the entire folder as a backup copy and then I need to reset the archive bit.
The problem is that I do not want to change any other attributes that may be set and for some reason I do not see a way to retain these while clearing the archive bit.
I am also not sure if the method I am using for checking the archive bit will work correctly in cases where the file is also read only or hidden or other such attribute.
I am trying to upgrade a VB 2003 program to VB 2005.One warning I am getting is:
'Public Shared ReadOnly Property AppSettings() As System.Collections.Specialized.NameValueCollection' is obsolete: 'This method is obsolete, it has been replaced by
I have an XML configuration file to which I will occasionally add new elements and, for ease of reading outside of the application, I want to keep it sorted alphabetically - by the "key" attribute of the "add" elements.After a lot of trial and error - using code I've gleaned from here, there and everywhere - I've come up with the code below. It appears to work okay, but I'm only just starting to learn Linq to XML, so I'd like to know whether this is an appropriate method or if there is a better/ more efficient method I've missed. It just feels like I might be taking an unnecessary step in recreating the entire file element.
Dim newEx = cfgEx.<appSettings>(0) newEx.Add(<add key=<%= sNewKey %> value=<%= sValue %>/>) Dim sortEx = <configuration>[code]....
EDIT: I think I've worked out a better way to do this - without explicitly recreating all the parent tags in thesortExvariable:
Dim newEx = cfgEx.<appSettings>(0) newEx.Add(<add key=<%= sNewKey %> value=<%= sValue %>/>) Dim sortEx = From c In newEx.<add> Order By c.@key Select c newEx.ReplaceAll(sortEx) cfgEx.Save(sXmlConfigFile)
There is a very strange problem with a Windows Service I am working on that I would like to understand why it occurs. The service loops every 5 minutes and then within that loop it loops through keys containing webservice URLs that are numbered such as:
If String.IsNullOrEmpty(AppSettings("OM." & intCount & ".Name").ToString) Then
When it hits a key that doesn't exist an exception is thrown and the service stops and waits for 5 minutes until the next loop.This usually works great but every week or two the Windows service will crash on that line without any Exception. The application log has a line from before that line but nothing after, none of the Try Catches are hit (the main one is catching the base "Exception" class).In the Event Log for Windows is the following:
The weird part is that this line of code is executing fine 300 times a day for at least a week which is around 2000 times before that one time it causes a full crash of the application. why this is occurring? I have changed that line of code to not rely on Exceptions and it has been working fine for a week now with no crash so could be something to do with too many Exceptions - maybe causing a stack overflow?
I am trying to access appSettings using the following syntax and I have used it before in my many website projects but not in a class library project. In this class library project I cannot even access the AppSettings Keys. Is there any way I could access the AppSettings Key from my class? Is the class library project's app.config or project structure behave in a different way?
[Code]...
I have already added Project Reference to System.Configuration and imported in my class. When I run my code it says, "Object not set to an instance of any object".
Sometimes in my web applications I used to get this sort of error, I have no clue why is it coming however if I refresh the page few times the page is loading normally.I am using .net framework 2.0 and visual web developer 2005.