muktesh

muktesh

  • NA
  • 11
  • 0

How to use using Ini?

Oct 19 2008 2:12 PM
i have a form in which there is textBox1 and textBox2. when anybody enter anything in textbox the value will be saved in .ini file on C drive.And when the form re-opens that value retrieves from that .ini file and shows in both textbox.
Following is the code there is only one error in this code.
The error is under using Ini; and it says that(The type namespace name 'Ini' could not be found are you missing a using directive or an assembly reference?).

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Ini;  (Error in this line only)
namespace IniTest
{
   
    public class Form1 : System.Windows.Forms.Form
    {

        public Form1()
        {
                        InitializeComponent();
        }
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            IniFile ini = new IniFile("C:\\test.ini");
            ini.IniWriteValue("Info","Name",textBox1.Text);
            ini.IniWriteValue("Info","LastName",textBox2.Text);
          
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            IniFile ini = new IniFile("C:\\test.ini");
            textBox1.Text= ini.IniReadValue("Info","Name");
            textBox2.Text = ini.IniReadValue("Info","LastName");
           }
    }
}

Answers (2)