Call RemplirLeDataGridView(DGV_DESSERT, "Dessert.ini")mon fichier ini est en ANSI j'ai essayer UTF-8 et ça ne fonctionne pas non plus.
Private Sub RemplirLeDataGridView(ByRef NomDuDataGridView As DataGridView, ByVal sNonFichierINI As String)
Dim bNumSection As Byte = 0
Call LireFichierINI(sPaths, sNonFichierINI)
NomDuDataGridView.RowCount = Math.Round((UBound(sTablSection) / 2), MidpointRounding.AwayFromZero) + 1
For bNbrLingne As Byte = 0 To NomDuDataGridView.RowCount - 1
For bNumCelleule As Byte = 0 To 1
If bNumSection < (UBound(sTablSection)) Then
NomDuDataGridView.Rows(bNbrLingne).Cells(bNumCelleule).Value = sTablSection(bNumSection)
bNumSection = bNumSection + 1
Else
Exit Sub
End If
Next
Next
NomDuDataGridView.Sort(NomDuDataGridView.Columns(0), System.ComponentModel.ListSortDirection.Ascending)
NomDuDataGridView.Sort(NomDuDataGridView.Columns(1), System.ComponentModel.ListSortDirection.Ascending)
Function LireFichierINI(ByVal sPath As String,
ByVal sFichierINI As String,
Optional ByVal sNomSection As String = "",
Optional ByVal sNomCle As String = "") As String
'Lire les sections
If sNomSection = "" Then
ReDim sTablSection(0)
Dim sSection() As String = Cls_Ini.INISectionNames(sPath & sFichierINI)
ReDim sTablSection(UBound(sSection))
For iSection As Integer = LBound(sSection) To UBound(sSection)
sTablSection(iSection) = sSection(iSection)
'Debug.Print("[" & sSection(iSection) & "]")
'Debug.Print(sTablMenuSemaineSection(iSection))
Next
Return ""
End If
en function
Cls_Ini
'Retourne tous les noms des sections existantes dans le fichier de configuration
Public Shared Function INISectionNames(ByVal INIPath As String) As String()
Dim maxsize As Integer = 500
While True
Dim bytes As Byte() = New Byte(maxsize - 1) {}
Dim size As Integer = GetPrivateProfileString(0, "", "", bytes, maxsize, INIPath)
If size < maxsize - 2 Then
Dim Selected As String = Encoding.ASCII.GetString(bytes, 0, size - (If(size > 0, 1, 0)))
Return Selected.Split(New Char() {ControlChars.NullChar})
End If
maxsize *= 2
End While
Return Nothing
End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Fichier INI
[Fudge]
sIngredient1=Sucre/1/0
sIngredient2=Cacao/1/0
sIngredient3=Beurre/1/0
sIngredient4=Lait cornation/1/0
[Biscuit]
sIngredient1=Sucre/0/1
sIngredient2=Cassonade/1/0
sIngredient3=Farine/0/1
sIngredient4=Pipite de chocolat/1/0
sIngredient5=Vanille/0/1
[Gâteau au banane]
sIngredient1=Sucre/0/1
sIngredient2=Banane/0/1
sIngredient3=Farine/0/1
[Muffin au pomme]
sIngredient1=Pomme/1/0
sIngredient2=Farine/0/1
sIngredient3=Sucre/1/0