473,377 Members | 1,153 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,377 software developers and data experts.

How to read and write a key_value from a file

Hello, I want to ask a question for a friend of mine.
(I haven't learned C# yet.)

How to read and write a key_value from a file.

I know in Java programming,could do like the following:
===============================
ResourceBundle xBundle = ResourceBundle.getBundle("xxxx");
String testStr = xBundle .getString("testStr")
===============================
In this way I can read the string value "testStr" from the
xxxx.properties.

So now the question is :
In the C# programming, is there any way to read and write
a string value(key_value) from a file. And the file is
"*.conf"¡£

Thanks.
Nov 16 '05 #1
2 2568
The equivalent in c# is ResourceManager.

When you create a .NET form (C# code) you will find a statement called

System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));

After getting resources you can get key and value by calling GetObject
Method.

For example to get the list of images you can say

resources.GetObject(""imageList1.ImageStream");

One more example may be

this.axListView1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.Get Object("axListView1.OcxSta
te")));

--
Shak
(Houston)


"IAMI" <wa**********@163.com> wrote in message
news:ON**************@TK2MSFTNGP11.phx.gbl...
Hello, I want to ask a question for a friend of mine.
(I haven't learned C# yet.)

How to read and write a key_value from a file.

I know in Java programming,could do like the following:
===============================
ResourceBundle xBundle = ResourceBundle.getBundle("xxxx");
String testStr = xBundle .getString("testStr")
===============================
In this way I can read the string value "testStr" from the
xxxx.properties.

So now the question is :
In the C# programming, is there any way to read and write
a string value(key_value) from a file. And the file is
"*.conf"¡£

Thanks.

Nov 16 '05 #2
I will foward this to my friend.

Thank you very much.

"Shakir Hussain" <sh**@fakedomain.com> дÈëÓʼþ
news:ev**************@TK2MSFTNGP09.phx.gbl...
The equivalent in c# is ResourceManager.

When you create a .NET form (C# code) you will find a statement called

System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));

After getting resources you can get key and value by calling GetObject
Method.

For example to get the list of images you can say

resources.GetObject(""imageList1.ImageStream");

One more example may be

this.axListView1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.Get Object("axListView1.OcxSta te")));

--
Shak
(Houston)


"IAMI" <wa**********@163.com> wrote in message
news:ON**************@TK2MSFTNGP11.phx.gbl...
Hello, I want to ask a question for a friend of mine.
(I haven't learned C# yet.)

How to read and write a key_value from a file.

I know in Java programming,could do like the following:
===============================
ResourceBundle xBundle = ResourceBundle.getBundle("xxxx");
String testStr = xBundle .getString("testStr")
===============================
In this way I can read the string value "testStr" from the
xxxx.properties.

So now the question is :
In the C# programming, is there any way to read and write
a string value(key_value) from a file. And the file is
"*.conf"¡£

Thanks.


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zhushenli | last post by:
Hello all, How to random read/write the file in fstream? BTW, how to access the file in block? Regards, Davy
5
by: Martin Svensson | last post by:
Hello! I need some help/recommendations on how to do the following. I have a program that writes an IP address two control numbers and a date to file, on one line. It's a basic text file and it...
8
by: Patrik Malmström | last post by:
How do I read, write a file binary? I want to open, say, file.exe read it in to the program, then write it out to file2.exe. Like file copy, anyone have a code sample?
2
by: Paul M | last post by:
Hy all In c# how can I read/write ini file? I need this for back compatibility. Is possible little example? For future, what is the best practice to replace ini file? app.config? xml files??...
0
by: Ahmed A. | last post by:
This will be very helpfull for many! Using RichTextBox Read/Write Unicode File http://www.microsoft.com/indonesia/msdn/wnf_RichTextBox.as p Private Function ReadFile(ByVal myfile As String)...
3
by: Trint Smith | last post by:
Is there anything like this that will allow a url address instread of a drive letter?: Dim fw As StreamWriter fw = New StreamWriter("D:\file.txt", True) fw.WriteLine(ex) fw.Close() The...
2
by: David Lozzi | last post by:
Howdy, Trying to open and read/write another aspx file from my aspx page. Basically I want to be able to update my aspx files from the website. Here's my code so far: Dim path As String =...
10
by: lorenzogordon | last post by:
Hi there, I'd greatly appreciate any insights into the following problem: I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP: 4.3.11). In PHP, the user uploads a file,...
2
by: Let_Me_Be | last post by:
Hi, I'm curently developing an aplication which gets called many times, and shoudl return a new state each time, I have implemented load/save state to work with istream/ostream. The problem is...
9
mickey0
by: mickey0 | last post by:
Hi, I have one problem; I must read a html like this; <html> <body> Hello </body> </html> I read this in a string (correct?) and after I have to do some changes to it and write it on disk...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.