I get underlined "End Function" declaration
("Function Read (any of functions below) doesn't return a value on all
code paths, Null reference coul'd return a runtime when function is
used")
Please help me.
Shall I bother this. (Mayby the functions will work without any
problems?)
Module Module2
Public Class ini
Private Declare Ansi Function GetPrivateProfileString Lib
"kernel32.dll" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As
String, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize As Integer,
ByVal lpFileName As String) As Integer
Private Declare Ansi Function GetPrivateProfileSection Lib
"kernel32" Alias "GetPrivateProfileSectionA" _
(ByVal lpAppName As String, ByVal lpReturnedString As String,
ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Private Declare Ansi Function WritePrivateProfileSection Lib
"kernel32" Alias "WritePrivateProfileSectionA" _
(ByVal lpAppName As String, ByVal lpString As String, ByVal
lpFileName As String) As Integer
Private Declare Ansi Function WritePrivateProfileString Lib
"kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String,
ByVal lpString As String, ByVal lpFileName As String) As Integer
Private ConfigObject As String
Public Sub New(ByVal strIniPathFileName As String)
ConfigObject = strIniPathFileName
End Sub
REM odczyt ciągów tekstowych
Public Function Read(ByVal Section As String, ByVal Key As
String, Optional ByVal strDefault As String = "") As String
Dim v As Integer, strTemp As String = ""
strTemp = strTemp.PadLeft(255, Chr(0))
v = GetPrivateProfileString(Section, Key, strDefault,
strTemp, 255, ConfigObject)
If v > 0 Then Read = Left(strTemp, v)
End Function
'odczyt sekcji
Public Function ReadSection(ByVal Section As String) As String
Dim v As Integer, strTemp As String = ""
strTemp = strTemp.PadLeft(4096, Chr(0))
v = GetPrivateProfileSection(Section, strTemp, 4096,
ConfigObject)
If v > 0 Then ReadSection = Left(strTemp, v - 1)
End Function
'zapis
Public Sub Save(ByVal Section As String, ByVal Key As String,
ByVal Value As String)
WritePrivateProfileString(Section, Key, Value,
ConfigObject)
End Sub
'zapis sekcji
Public Sub SaveSection(ByVal Section As String, ByVal Value As
String)
WritePrivateProfileSection(Section, Value, ConfigObject)
End Sub
'usuwanie klucza
Public Sub RemoveKey(ByVal Section As String, ByVal Key As
String)
WritePrivateProfileString(Section, Key, vbNullString,
ConfigObject)
End Sub
'usuwanie sekcji
Public Sub RemoveSection(ByVal Section As String)
WritePrivateProfileString(Section, vbNullString, "",
ConfigObject)
End Sub
Public myIni As New ini("C:\Plan\PNConfig.ini")
'Public myIni As New ini(Application.StartupPath &
"\Plik.ini")
End Class
End Module
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net