|
 |
|
silverlight สามารถอ่าน .ini ได้หรือไม่ครับ ลองใช้แบบ web แล้ว errorตามรูป รบกวนขอคำแนะนำด้วยครับ |
|
 |
|
|
 |
 |
|
Class TestINI.cs
Code (C#)
string path;
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(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);
public TestINI(string path)//รับ path ของไฟล์ .ini เข้ามาทาง constructor
{
this.path = path;
}
public void IniWriteValue(string Section, string Key, string Value)//เขียนไฟล์
{
WritePrivateProfileString(Section, Key, Value, this.path);
}
public string IniReadValue(string Section, string Key)//อ่าน value จาก section และ key
{
StringBuilder sb = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", sb, 255, this.path);
return sb.ToString();
}
Example.xaml.cs
Code (C#)
string re_Height = ti.IniReadValue("Resolution", "Height");
ขึ้น error ตามรูปครับ

Tag : .NET, VS 2010 (.NET 4.x)

|
|
 |
 |
 |
 |
Date :
2011-06-20 12:41:34 |
By :
gumgumkung |
View :
926 |
Reply :
0 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 00
|