IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Info double combobox a partir d'un fichier


Sujet :

VB.NET

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut Info double combobox a partir d'un fichier
    Je charge dans un combobox("reference") les infos d'un fichier.txt qui a la forme :
    (reference;designation;couleur;conditionnement;code-barre)
    12568;abricot;U;Unite;12568U;;
    26037;pomme;J;carton;26037J;;
    26037;pomme;R;carton;26037R;;
    26444;ananas;B;unite;26444B;;

    J'ai bien toute les ref dans la combobox mais la 26037 en double.
    Je charge les références, je voudrais ne faire apparaitre qu'une seule fois la ref: 26037 au lieu de 2 fois comment dois je faire.
    Et sur une combobox ("couleur") faire apparaitre les 2 couleurs selon la référence.



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Try
                lists = System.IO.File.ReadAllLines(path, System.Text.Encoding.Default).ToList
                For Each items As String In lists
                    parts = items.Split(New Char() {";"}, StringSplitOptions.RemoveEmptyEntries)
                    reference.Items.Add(parts(0))
                Next
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try

  2. #2
    Membre confirmé Avatar de licardentaistor
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Juillet 2021
    Messages
    316
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Juillet 2021
    Messages : 316
    Points : 453
    Points
    453
    Par défaut
    Bonjour,

    vous pouvez utiliser FindString, afin de vérifier si l'élément existe déjà.

    https://docs.microsoft.com/en-us/dot...System_String_

  3. #3
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    J'ai réussi a supprimer les doublons mais pas a faire apparaitre le choix pour les couleurs je ne vois pas trop comment faire.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Try
                lists = System.IO.File.ReadAllLines(path, System.Text.Encoding.Default).ToList
                For Each items As String In lists
                    parts = items.Split(New Char() {";"}, StringSplitOptions.RemoveEmptyEntries)
                    Dim variable As String
                    If parts(0) = variable Then
                    Else
                        reference.Items.Add(parts(0))
                        variable = parts(0)
                    End If

  4. #4
    Membre confirmé Avatar de licardentaistor
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Juillet 2021
    Messages
    316
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Juillet 2021
    Messages : 316
    Points : 453
    Points
    453
    Par défaut
    avec 2 combobox cbref et cbCoul
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
        Dim lists = System.IO.File.ReadAllLines("test.txt", System.Text.Encoding.Default).ToList
            For Each items As String In lists
                Dim parts = items.Split(New Char() {";"}, StringSplitOptions.RemoveEmptyEntries)
                Dim variable As String
                If parts(0) = variable Then
                Else
                    cbRef.Items.Add(parts(0))
                    variable = parts(0)
                End If
            Next
        End Sub
     
        Private Sub cbRef_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbRef.SelectedIndexChanged
            cbCoul.Items.Clear()
            Dim lists = System.IO.File.ReadAllLines("test.txt", System.Text.Encoding.Default).ToList
            For Each items As String In lists
                Dim parts = items.Split(New Char() {";"}, StringSplitOptions.RemoveEmptyEntries)
                If parts(0) = cbRef.Text Then
                    cbCoul.Items.Add(parts(2))
                End If
            Next
        End Sub

  5. #5
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    Bonjour,
    perso vola comment je fais!
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    Private Function OpenFtxt(folder As String, SQL As String, Shemat As String, Titre As Boolean) As DataTable
            Dim objWriter As New System.IO.StreamWriter($"{folder}\schema.ini", False)
            objWriter.WriteLine(Shemat)
            objWriter.Close()
            Dim con = $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={folder};Extended Properties=""text;HDR={If(Titre, "Yes", "No")};FMT=Delimited"";"
            Dim dt As New DataTable
     
     
            Using Adp As New OleDbDataAdapter(SQL, con)
                Adp.Fill(dt)
                Return dt
            End Using
        End Function
    et dans le code je fais ça!
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     Dim Shema As String = "[Fruits.txt]
                Format= Delimited(;)"
            Me.ComboBox1.DataSource = OpenFtxt("C:\Myrep\Fruits", "Select Distinct [reference] From [Fruits.txt] order By  [reference]", Shema, True)
            ComboBox1.ValueMember = "reference"
            ComboBox1.DisplayMember = "reference"
    reference;designation;couleur;conditionnement;code-barre
    12568;abricot;U;Unite;12568U;;
    26037;pomme;J;carton;26037J;;
    26037;pomme;R;carton;26037R;;
    26444;ananas;B;unite;26444B;;

  6. #6
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    Merci pour vos réponses

    licardentaistor Dans la Cbcouleur si on a 2 références avec 2 couleurs différente est ce que la cbcouleur va proposer les 2 couleurs ?



    Citation Envoyé par licardentaistor Voir le message
    avec 2 combobox cbref et cbCoul
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
        Dim lists = System.IO.File.ReadAllLines("test.txt", System.Text.Encoding.Default).ToList
            For Each items As String In lists
                Dim parts = items.Split(New Char() {";"}, StringSplitOptions.RemoveEmptyEntries)
                Dim variable As String
                If parts(0) = variable Then
                Else
                    cbRef.Items.Add(parts(0))
                    variable = parts(0)
                End If
            Next
        End Sub
     
        Private Sub cbRef_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbRef.SelectedIndexChanged
            cbCoul.Items.Clear()
            Dim lists = System.IO.File.ReadAllLines("test.txt", System.Text.Encoding.Default).ToList
            For Each items As String In lists
                Dim parts = items.Split(New Char() {";"}, StringSplitOptions.RemoveEmptyEntries)
                If parts(0) = cbRef.Text Then
                    cbCoul.Items.Add(parts(2))
                End If
            Next
        End Sub

  7. #7
    Membre confirmé Avatar de licardentaistor
    Homme Profil pro
    Administrateur de base de données
    Inscrit en
    Juillet 2021
    Messages
    316
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Administrateur de base de données

    Informations forums :
    Inscription : Juillet 2021
    Messages : 316
    Points : 453
    Points
    453
    Par défaut
    oui mais mon code a été fait à l'arrache, ça fonctionne.... celui de Thumb tiens plus la route.

  8. #8
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    Imports System.Data.OleDbImports System.IO
    Imports System.Linq
    Imports System
     
     
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim Shema As String = "[Fruits.txt]
                Format= Delimited(;)"
            With Me.cbRef
                .DataSource = OpenFtxt("C:\Myrep\Fruits", "Select Distinct [reference] From [Fruits.txt] order By  [reference]", Shema, True)
                .ValueMember = "reference"
                .DisplayMember = "reference"
            End With
             MessageBox.Show(Reperoire("Chemin du fichier légumes :C:test\\test1.TXT"))
        End Sub
        Private Sub cbRef_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbRef.SelectedIndexChanged
            If cbRef.SelectedIndex > -1 Then
                Dim Shema As String = "[Fruits.txt]
                    Format= Delimited(;)"
                With cbCoul
                    .DataSource = OpenFtxt("C:\Myrep\Fruits", $"Select Distinct [couleur] From [Fruits.txt] WHERE [reference]={cbRef.Text}  order By  [couleur]", Shema, True)
                    .ValueMember = "couleur"
                    .DisplayMember = "couleur"
                End With
            End If
        End Sub
        Function Reperoire(ByVal txt As String) As String
            Dim pose As Long = txt.IndexOf(":") + 1
            txt = txt.Substring(pose, txt.Length - pose).Replace("\", ":").Replace(":", ":\").Replace("\\", "\")
            If txt.Substring(0, 1) = "\" Then txt = "\" + txt
            Return txt
        End Function
        Private Function OpenFtxt(folder As String, SQL As String, Shemat As String, Titre As Boolean) As DataTable
            Dim objWriter As New System.IO.StreamWriter($"{folder}\schema.ini", False)
            objWriter.WriteLine(Shemat)
            objWriter.Close()
            Dim con As String = $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={folder};Extended Properties='text;HDR={If(Titre, "Yes", "No")};FMT=Delimited';"
            Dim dt As New DataTable
            Using Adp As New OleDbDataAdapter(SQL, con)
                Try
                    Adp.Fill(dt)
                    Return dt
                Catch ex As Exception
                    Return Nothing
                End Try
            End Using
        End Function
    End Class

  9. #9
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    Merci thumb
    Je vais essayer de comprendre ton programme pas évident
    Je te joint mon prog car je dois rajouter le conditionnement et la désignation
    Merci encore du boulot




    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    Dim selectitemreference As String
            selectitemreference = reference.SelectedItem
            Dim infocomp As List(Of String) = System.IO.File.ReadAllLines(chemin).ToList
            Dim value As String
            For Each line As String In infocomp
     
                If line.StartsWith(selectitemreference) Then
                    value = Split(line, ";")(1)
                    designation.Text = value
                    value = Split(line, ";")(3)
                    conditionement.Text = value
                    'couleur a incérer
                    Exit For
                End If
            Next

  10. #10
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    Bonjour,
    Je suis pas certain d'avoir compris !

    Tu parcours tout ton fichier pour ne renseigner que 2 contrôle effaçant part là même les valeurs de la ligne précédente ?

  11. #11
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    ah oui avec ce code j'arrive a ecrire le conditionnement et la designation mais pas la couleur si j'ai deux fois la meme reference.

  12. #12
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
        Private Sub cbRef_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbRef.SelectedIndexChanged
     
            If cbRef.SelectedIndex > -1 Then
                Dim Shema As String = "[Fruits.txt]
                    Format= Delimited(;)"
                With cbCoul
                    .DataSource = OpenFtxt("C:\Myrep\Fruits", $"Select Distinct [couleur] From [Fruits.txt] WHERE [reference]={cbRef.Text}  order By  [couleur]", Shema, True)
                    .ValueMember = "couleur"
                    .DisplayMember = "couleur"
                End With
                Dim td As DataTable = OpenFtxt("C:\Myrep\Fruits", $"Select Distinct [designation],[conditionnement] From [Fruits.txt] WHERE [reference]={cbRef.Text}", Shema, True)
                If td IsNot Nothing Then
                    With td
                        If .Rows.Count > 0 Then
                            With .Rows(0)
                                designation.Text = .Item("designation")
                                conditionement.Text = .Item("conditionnement")
                            End With
                        End If
                    End With
                End If
            End If
        End Sub

  13. #13
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    merci je vais tester ton programme


    J'ai pas 2 fichiers fruit et légume mais qu'un fichier txt ou j'ai tout dedans.

  14. #14
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    moi je me suis fait un fichier d'exemple en fonction de tes indication, il fallait bien que je lui donne un nom vu qu tu nous as jamais donné le nom du fichier !

    remplaces C:\Myrep\Fruits part le chemin exacte ou ce trouve ton fichier et [Fruits.txt] par le nom de ton fichier [fruit et légume.txt]

    Si tu travailles toujours sur le même fichier tu pourras passer ses informations en constantes dan la partie déclaratives du formulaire pour ne pas les réécrire dans les différentes méthodes !

  15. #15
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    pourquoi j'ai openftxt en rouge n'est pas déclare

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    .DataSource = OpenFtxt("C:\Articles", $"Select Distinct [couleur] From [articles.txt] WHERE [reference]={reference.Text}  order By  [couleur]", Shema, True)

  16. #16
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    Tu veux dire qu'il est souligné en rouge dans ton code?

  17. #17
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    oui

  18. #18
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    j'ai apporté des modification à mon code à adapté a ton projet!
    Code zone de déclaration des constantes : Sélectionner tout - Visualiser dans une fenêtre à part
     Const MyRep As String = "C:\Myrep\Fruits", MyFichier = "reference.txt"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    Imports System.Data.OleDbPublic Class Form1
        Const MyRep As String = "C:\Myrep\Fruits", MyFichier = "reference.txt"
        Dim Shema As String = $"[{MyFichier}]
                Format= Delimited(;)"
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            With Me.cbRef
                .SelectedIndex = -1
                .DataSource = OpenFtxt(MyRep, $"Select Distinct [reference] From [{MyFichier}] order By  [reference]", Shema, True)
                .ValueMember = "reference"
                .DisplayMember = "reference"
            End With
            MessageBox.Show(Reperoire("Chemin du fichier légumes :C:test\\test1.TXT"))
        End Sub
        Private Sub cbRef_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbRef.SelectedIndexChanged
            If cbRef.SelectedIndex > -1 Then
                With cbCoul
                    .DataSource = OpenFtxt(MyRep, $"Select Distinct [couleur] From [{MyFichier}] WHERE [reference]={cbRef.Text}  order By  [couleur]", Shema, True)
                    .ValueMember = "couleur"
                    .DisplayMember = "couleur"
                End With
                Dim td As DataTable = OpenFtxt(MyRep, $"Select Distinct [designation],[conditionnement] From [{MyFichier}] WHERE [reference]={cbRef.Text}", Shema, True)
                If td IsNot Nothing Then
                    With td
                        If .Rows.Count > 0 Then
                            With .Rows(0)
                                designation.Text = .Item("designation")
                                conditionement.Text = .Item("conditionnement")
                            End With
                        End If
                    End With
                End If
     
     
            End If
     
     
        End Sub
        Function Reperoire(ByVal txt As String) As String
            Dim pose As Long = txt.IndexOf(":") + 1
            txt = txt.Substring(pose, txt.Length - pose).Replace("\", ":").Replace(":", ":\").Replace("\\", "\")
            If txt.Substring(0, 1) = "\" Then txt = "\" + txt
            Return txt
        End Function
        Private Function OpenFtxt(folder As String, SQL As String, Shemat As String, Titre As Boolean) As DataTable
            Dim objWriter As New System.IO.StreamWriter($"{folder}\schema.ini", False)
            objWriter.WriteLine(Shemat)
            objWriter.Close()
            Dim con As String = $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={folder};Extended Properties='text;HDR={If(Titre, "Yes", "No")};FMT=Delimited';"
            Dim dt As New DataTable
     
     
            Using Adp As New OleDbDataAdapter(SQL, con)
                Try
                    Adp.Fill(dt)
                    Return dt
                Catch ex As Exception
                    Return Nothing
                End Try
     
     
            End Using
        End Function
    End Class

  19. #19
    Nouveau membre du Club
    Homme Profil pro
    Lycéen
    Inscrit en
    Décembre 2021
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2021
    Messages : 117
    Points : 37
    Points
    37
    Par défaut
    Merci pour les codes je vais tester

    C'est a placer ou tout en haut des codes ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Const MyRep As String = "C:\Myrep\Fruits", MyFichier = "reference.txt"

    et


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Imports System.Data.OleDbPublic Class Form1

  20. #20
    Membre chevronné Avatar de Thumb down
    Homme Profil pro
    Retraité
    Inscrit en
    Juin 2019
    Messages
    1 420
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Juin 2019
    Messages : 1 420
    Points : 2 179
    Points
    2 179
    Par défaut
    quand je fait un copier collé le premier retour à la ligne ne ce fait pas, alors si je fais pas gaf ça ce retrouve sur un même ligne!
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Imports System.Data.OleDb
    Public Class Form1
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Imports System.Data.OleDb
    
    Public Class Form1
        Const MyRep As String = "C:\Myrep\Fruits", MyFichier = "reference.txt"
        Dim Shema As String = $"[{MyFichier}]
                Format= Delimited(;)"

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Réponses: 1
    Dernier message: 15/11/2019, 12h52
  2. chargement d'un combobox à partir d'un fichier text
    Par claire_cartier dans le forum GTK+ avec C & C++
    Réponses: 1
    Dernier message: 09/04/2007, 14h45
  3. Chargement d'un combobox à partir d'un fichier text
    Par claire_cartier dans le forum GTK+ avec C & C++
    Réponses: 7
    Dernier message: 04/04/2007, 10h04
  4. Réponses: 2
    Dernier message: 26/01/2007, 14h58
  5. ComboBox dynamique à partir de fichier XML
    Par ikeaboy dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 28/07/2006, 09h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo