「getProfileString」の編集履歴(バックアップ)一覧はこちら
getProfileString - (2008/02/18 (月) 16:10:49) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
// 現在のページ名
*&this_page()
**概要
iniファイルから文字列を取得する。
***引数
-iniファイルのパス
-セクション名
-エントリー名
***戻値
-文字列
**前提条件
-[[新しいwebサイトの作成]]
**手順
default.aspx と同じディレクトリに「setting.ini」というファイルを作成する。
#highlight(ini){
[section]
test=てすと
}
default.aspx.vb を以下のように変更。
#highlight(vb.net){
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write(GetProfileString(Server.MapPath("setting.ini"), "section", "test"))
End Sub
Protected Function GetProfileString(ByVal strPath, ByVal strSection, ByVal strEntry)
On Error Resume Next
Dim bFound As Boolean
Dim fileno As Integer
Dim str_return As String = ""
Dim str_Line As String
Dim array_work As Array
fileno = FreeFile()
FileOpen(fileno, strPath, OpenMode.Input)
bFound = False
While Not EOF(fileno)
str_Line = LineInput(fileno)
If bFound Then
If Left(str_Line, 1) = "[" Then
Exit While
End If
str_Line = LTrim(str_Line)
If Left(str_Line, Len(strEntry)) = strEntry Then
array_work = Split(str_Line, "=")
If Trim(array_work(0)) = strEntry Then
If UBound(array_work) = 1 Then
str_return = Trim(array_work(1))
Exit While
End If
End If
End If
End If
If str_Line = "[" & strSection & "]" Then
bFound = True
End If
End While
FileClose(fileno)
On Error GoTo 0
Return str_return
End Function
End Class
}
&img(241.jpg)
// 現在のページ名
*&this_page()
**概要
iniファイルから文字列を取得する。
***引数
-iniファイルのパス
-セクション名
-エントリー名
***戻値
-文字列
**前提条件
-[[新しいwebサイトの作成]]
**手順
default.aspx と同じディレクトリに「setting.ini」というファイルを作成する。
#highlight(ini){
[section]
test=てすと
}
default.aspx.vb を以下のように変更。
#highlight(vb.net){
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write(GetProfileString(Server.MapPath("setting.ini"), "section", "test"))
End Sub
End Class
}
&img(241.jpg)
表示オプション
横に並べて表示:
変化行の前後のみ表示: