[C #]: How to read the INI file in C # (3)

zhaozj2021-02-16  50

Using system;

Using system.drawing;

Using system.collections;

Using system.componentmodel;

Using system.windows.forms;

Using system.data;

Using system.Runtime.InteropServices;

Using system.text;

Namespace c_ operation ini file __ write operation

{

Public Class Form1: System.Windows.Forms.form

{

Private system.windows.Forms.Button button1;

Private system.windows.Forms.TextBox textBox1;

Private system.windows.Forms.Button Button2;

Private system.windows.Forms.TextBox textBox2;

Private system.windows.Forms.TextBox textBox3;

Private system.windows.Forms.TextBox textBox4;

Private system.windows.Forms.Label label1;

Private system.windows.Forms.Label label2;

Private system.windows.Forms.Label label3;

Private system.windows.Forms.Button Button3;

Private system.windows.forms.openfiledialog openfiledialog1;

Private system.componentmodel.Container Components = NULL;

Public Form1 ()

{

InitializationComponent ();

}

Protected Override Void Dispose (Bool Disposing)

{

IF (Disposing)

{

IF (Components! = NULL)

{

Components.dispose ();

}

}

Base.dispose (Disposing);

}

[DLLIMPORT ("kernel32")]]

Private static extern long writPrivateProfileString (String

Section,

String Key, String Val, String FilePath;

[DLLIMPORT ("kernel32")]]

Private static extern int GETPRIVATEPROFILESTRING (String Section,

String Key, String Def, StringBuilder RetVal,

INT size, String filepath;

Private vidinitiRizeComponent ()

{

This.button1 = new system.windows.Forms.Button ();

This.TextBox1 = new system.windows.Forms.TextBox ();

This.Button2 = new system.windows.Forms.Button ();

This.TextBox2 = new system.windows.Forms.TextBox ();

This.TextBox3 = new system.windows.Forms.TextBox ();

This.TextBox4 = new system.windows.Forms.TextBox ();

THIS.LABEL1 = New System.windows.Forms.label ();

THIS.LABEL2 = New System.windows.Forms.label ();

This.label3 = new system.windows.Forms.label ();

This.Button3 = new system.windows.Forms.Button ();

this.openfiledialog1 = new

System.windows.Forms.openFileDialog ();

THIS.SUSPENDLAYOUT ();

This.button1.flatstyle = system.windows.Forms.Flatstyle.FLAT;

This.button1.location = new system.drawing.point (238, 20);

This.button1.name = "button1";

This.button1.size = new system.drawing.size (100, 32);

this.button1.tabindex = 0;

This.button1.text = "Select Ini File";

This.Button1.click = new system.eventhandler (this.button1_click);

This.TextBox1.Location = New System.drawing.point (58, 22);

THIS.TEXTBOX1.NAME = "TextBox1";

THIS.TEXTBOX1.SIZE = New System.drawing.size (162, 21);

this.TextBox1.tabindex = 1;

THIS.TEXTBOX1.TEXT = "";

This.button2.flatstyle = system.windows.Forms.Flatstyle.FLAT;

This.Button2.Location = new system.drawing.point (86, 168);

This.Button2.name = "button2";

This.button2.size = new system.drawing.size (98, 30);

转载请注明原文地址:https://www.9cbs.com/read-22179.html

New Post(0)