473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Reading/Updating from/to XML

Hi, so I'm kinda new to working with data in VB.NET, and the easiest method seems to be XML, since ini isn't supported. So I tried but couldn't find a way to read XML attributes and then replace/update them if needed. So for example I have this XML File:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Entries>
  3. <Entry1 font="Arial.ttf" R="255" G="255" B="255" effect="Stroke"></Entry1>
  4. <Entry2></Entry2> - In the same format
  5. </Entries>
  6.  
How do I load those as strings, for example I want to write them to a file later, and I use the code:

Expand|Select|Wrap|Line Numbers
  1. sw.WriteLine("Font")
  2.  
But instead I want to load the attribute from Entry1, instead of loading it from pre-defined variables.

Oh and one more thing I want, when the user clicks a button to update an attribute (Font for example) to the current textbox text.

Sorry it's a long question but I've been searching for days now and I can't work it out...
Jul 15 '10 #1
1 983
Joseph Martell
198 Expert 128KB
Have you explored the app.config file? The .Net framework alrady includes a bunch of classes for working with an app.config file, which is stored as XML. An app.config file will have an "appSettings" element that can be used to store custom information like colors and locations (or anything else for that matter). Individual entries are added in the format:

Expand|Select|Wrap|Line Numbers
  1. <add key="keyName" value="information" />
Then, when you want to retrieve the information you would do something like:

Expand|Select|Wrap|Line Numbers
  1. System.Configuration.ConfigurationManager.AppSettings.Get("keyName")
You can also use a "set" method to set values at runtime.
Jul 19 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: matt | last post by:
I'm reading lines from a file to display an image. Each image and caption is on a new line. I read the string from each line, up until the line break (\r\n) and then assume my fields are starting...
3
by: Catherine Lynn Smith | last post by:
I'm looking through the client side javascript reference and there's some mighty useful information in here, but it is not very specific on 'reading' information from event handlers. In the...
4
by: Mateo | last post by:
Hi! I have labels on my page (some are web forms controls, and some are plain HTML labels), and I need Mozilla compatibile way for reading label value. For example, in IE I can use this:...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
8
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the...
8
namcintosh
by: namcintosh | last post by:
I really need some help. I am trying to read some information from a file in C++. Here is the program that I wrote. (Beware, I am very new to this, so don't freak out if the program seems a...
21
by: Naya | last post by:
Hello, everyone!!! Well, I have a situation here. I am trying to read this data from a file, but the wrong values keep spitting out at me. Here's what I mean: Program: int main() {...
11
by: downwitch | last post by:
Hi, I'm using a 3rd-party app's back end which stores SQL statements in a table, so I have no choice but to use dynamic SQL to call them (unless someone else knows a workaround...) Problem...
1
by: Diego F. | last post by:
Hello. I have a problem while reading bytes from a socket. According to my test, it seems that the buffer maximum size is 8192 bytes. Then, I use a byte array with that size to read from the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.