Imports System.Resources Imports System.Reflection Imports System.IO Public Class Form1 Public Sub New() ' Cet appel est requis par le concepteur. InitializeComponent() ' Ajoutez une initialisation quelconque après l'appel InitializeComponent(). Dim loEnumerator As IDictionaryEnumerator Dim loManager As ResourceManager Dim loReader As ResourceReader Dim lcName As String loManager = My.Resources.ResourceManager lcName = loManager.BaseName & ".resources" With Assembly.GetExecutingAssembly loReader = New ResourceReader(.GetManifestResourceStream(lcName)) End With loEnumerator = loReader.GetEnumerator While loEnumerator.MoveNext Dim A As Object A = My.Resources.ResourceManager.GetObject(CStr(loEnumerator.Key)) If A.GetType = GetType(Bitmap) Then ListBox1.Items.Add(loEnumerator.Key) End If End While loReader.Close() End Sub Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Dim auto As String auto = ListBox1.SelectedItem.ToString() RichTextBox1.Clear() Dim ResourceName As String = auto & "1" Dim ResourceContents As String = CStr(My.Resources.ResourceManager.GetObject(ResourceName)) RichTextBox1.Text = ResourceContents PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ListBox1.SelectedItem.ToString), Image) End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim i As Integer Dim listString As String Dim reponse As String reponse = TextBox1.Text If reponse = "" Then Exit Sub For i = 0 To ListBox1.Items.Count - 1 listString = CStr(ListBox1.Items.Item(i)) If CBool(InStr(listString.ToLower, reponse.ToLower)) Then ListBox1.SelectedItems.Add(listString) End If Next ' MessageBox.Show("Recherche terminée.", "Recherche", MessageBoxButtons.OK, MessageBoxIcon.Information) listString = Nothing End Sub End Class
( Petite remarque au gestionnaire du site: Avec les +1 , l'ensemble de la discussion est un peu décousu )
Imports System.Resources
Imports System.Reflection
Public Class Form1
Public Sub New()
' Cet appel est requis par le concepteur.
InitializeComponent()
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
Dim loEnumerator As IDictionaryEnumerator
Dim loManager As ResourceManager
Dim loReader As ResourceReader
Dim lcName As String
loManager = My.Resources.ResourceManager
lcName = loManager.BaseName & ".resources"
With Assembly.GetExecutingAssembly
loReader = New ResourceReader(.GetManifestResourceStream(lcName))
End With
loEnumerator = loReader.GetEnumerator
While loEnumerator.MoveNext
Dim A As Object
A = My.Resources.ResourceManager.GetObject(loEnumerator.Key)
If A.GetType = GetType(Bitmap) Then
ListBox1.Items.Add(loEnumerator.Key)
End If
End While
loReader.Close()
End Sub
Private Sub ListBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedValueChanged
PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ListBox1.SelectedItem.ToString), Image)
End Sub
End Class
Private Sub Combobox1_SelectedValueChanged
Label1.Text=Combobox1.Text ' Par exemple
...
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionImports System.Resources Imports System.Reflection Imports System.IO Public Class Form1 Public Sub New() ' Cet appel est requis par le concepteur. InitializeComponent() ' Ajoutez une initialisation quelconque après l'appel InitializeComponent(). Dim loEnumerator As IDictionaryEnumerator Dim loManager As ResourceManager Dim loReader As ResourceReader Dim lcName As String loManager = My.Resources.ResourceManager lcName = loManager.BaseName & ".resources" With Assembly.GetExecutingAssembly loReader = New ResourceReader(.GetManifestResourceStream(lcName)) End With loEnumerator = loReader.GetEnumerator While loEnumerator.MoveNext Dim A As Object A = My.Resources.ResourceManager.GetObject(loEnumerator.Key) If A.GetType = GetType(Bitmap) Then ListBox1.Items.Add(loEnumerator.Key) End If End While loReader.Close() End Sub Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Dim auto As String auto = ListBox1.SelectedItem.ToString() If My.Computer.FileSystem.FileExists(My.Application.Info.DirectoryPath & "\Configuration\" & auto & ".txt") Then RichTextBox1.Clear() RichTextBox1.LoadFile(My.Application.Info.DirectoryPath & "\Configuration\" & auto & ".txt") End If PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ListBox1.SelectedItem.ToString), Image) End Sub End Class
Imports System.Resources Imports System.Reflection Imports System.IO Public Class Form1 Public Sub New() ' Cet appel est requis par le concepteur. InitializeComponent() ' Ajoutez une initialisation quelconque après l'appel InitializeComponent(). Dim loEnumerator As IDictionaryEnumerator Dim loManager As ResourceManager Dim loReader As ResourceReader Dim lcName As String loManager = My.Resources.ResourceManager lcName = loManager.BaseName & ".resources" With Assembly.GetExecutingAssembly loReader = New ResourceReader(.GetManifestResourceStream(lcName)) End With loEnumerator = loReader.GetEnumerator While loEnumerator.MoveNext Dim A As Object A = My.Resources.ResourceManager.GetObject(CStr(loEnumerator.Key)) If A.GetType = GetType(Bitmap) Then ListBox1.Items.Add(loEnumerator.Key) End If End While loReader.Close() End Sub Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Dim auto As String 'cherche le chemin du dossier Resources auto = ListBox1.SelectedItem.ToString() Dim path As String = Application.StartupPath path = Replace(path, "bin\Debug", "Resources") path = path & "\" & auto & ".txt" RichTextBox1.Clear() RichTextBox1.LoadFile(path) PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ListBox1.SelectedItem.ToString), Image) End Sub End Class
Imports System.Resources
Imports System.Reflection
Imports System.IO
Public Class Form9
Public Sub New()
' Cet appel est requis par le concepteur.
InitializeComponent()
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
Dim loEnumerator As IDictionaryEnumerator
Dim loManager As ResourceManager
Dim loReader As ResourceReader
Dim lcName As String
loManager = My.Resources.ResourceManager
lcName = loManager.BaseName & ".resources"
With Assembly.GetExecutingAssembly
loReader = New ResourceReader(.GetManifestResourceStream(lcName))
End With
loEnumerator = loReader.GetEnumerator
While loEnumerator.MoveNext
Dim A As Object
A = My.Resources.ResourceManager.GetObject(CStr(loEnumerator.Key))
If A.GetType = GetType(Bitmap) Then
ListBox1.Items.Add(loEnumerator.Key)
End If
End While
loReader.Close()
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim auto As String
auto = ListBox1.SelectedItem.ToString()
RichTextBox1.Clear()
Dim ResourceName As String = auto & "1"
Dim ResourceContents As String = CStr(My.Resources.ResourceManager.GetObject(ResourceName))
RichTextBox1.Text = ResourceContents
PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ListBox1.SelectedItem.ToString), Image)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim listString As String
Dim reponse As String
reponse = TextBox1.Text
If reponse = "" Then Exit Sub
For i = 0 To ListBox1.Items.Count - 1
listString = CStr(ListBox1.Items.Item(i))
If CBool(InStr(listString.ToLower, reponse.ToLower)) Then
ListBox1.SelectedItems.Add(listString)
End If
Next
' MessageBox.Show("Recherche terminée.", "Recherche", MessageBoxButtons.OK, MessageBoxIcon.Information)
listString = Nothing
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
ListBox1.Visible = True
ListBox2.Visible = False
ListBox3.Visible = False
ListBox4.Visible = False
End If
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
ListBox1.Visible = False
ListBox2.Visible = True
ListBox3.Visible = False
ListBox4.Visible = False
End If
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
If RadioButton3.Checked = True Then
ListBox1.Visible = False
ListBox2.Visible = False
ListBox3.Visible = True
ListBox4.Visible = False
End If
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged
If RadioButton4.Checked = True Then
ListBox1.Visible = False
ListBox2.Visible = False
ListBox3.Visible = False
ListBox4.Visible = True
End If
End Sub
End Class
Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged If ListBox1.Items.Count = 0 Then Exit Sub If RadioButton1.Checked = True Then ListBox1.SelectionMode = SelectionMode.MultiExtended ListBox2.Items.Clear() For i As Integer = 0 To 400 ' a adapter ListBox1.SetSelected(i, True) ListBox2.Items.Add(ListBox1.Items(i).ToString.ToLower) Next i End If End Sub Private Sub RadioButton2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton2.CheckedChanged If ListBox1.Items.Count = 0 Then Exit Sub If RadioButton2.Checked = True Then ListBox1.SelectionMode = SelectionMode.MultiExtended ListBox3.Items.Clear() For i As Integer = 400 To 800 ' a adapter ListBox1.SetSelected(i, True) ListBox3.Items.Add(ListBox1.Items(i).ToString.ToLower) Next i End If
MsgBox(ListBox1.SelectedIndex)
Dim nom As String = ListBox2.SelectedItem.ToString() 'recherche nom cliqué
ListBox1.SelectedIndex = ListBox1.FindString(nom) 'sélectionne l'élement dans la listBox1
Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged If ListBox1.Items.Count = 0 Then Exit Sub Dim auto As String auto = ListBox1.SelectedItem.ToString() MsgBox(ListBox1.SelectedIndex) 'à supprimer après le tri RichTextBox1.Clear() Dim ResourceName As String = auto & 1 Dim ResourceContents As String = CStr(My.Resources.ResourceManager.GetObject(ResourceName)) RichTextBox1.Text = ResourceContents PictureBox1.Image = CType(My.Resources.ResourceManager.GetObject(ListBox1.SelectedItem.ToString), Image) End Sub Private Sub ListBox2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox2.SelectedIndexChanged If ListBox2.Items.Count = 0 Then Exit Sub Dim nom As String = ListBox2.SelectedItem.ToString() 'recherche nom cliqué ListBox1.SelectedIndex = ListBox1.FindString(nom) 'sélectionne l'élement dans la listBox1 End Sub Private Sub ListBox3_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox3.SelectedIndexChanged If ListBox3.Items.Count = 0 Then Exit Sub Dim nom As String = ListBox3.SelectedItem.ToString() 'recherche nom cliqué ListBox1.SelectedIndex = ListBox1.FindString(nom) 'sélectionne l'élement dans la listBox1 End Sub Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged If ListBox1.Items.Count = 0 Then Exit Sub If RadioButton1.Checked = True Then ListBox2.Items.Clear() For i As Integer = 0 To 400 ' a adapter en cherchant l'itndex dans la listBox1 ListBox2.Items.Add(ListBox1.Items(i).ToString.ToLower) Next i End If End Sub Private Sub RadioButton2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton2.CheckedChanged If ListBox1.Items.Count = 0 Then Exit Sub If RadioButton2.Checked = True Then ListBox3.Items.Clear() For i As Integer = 401 To 800 ' a adapter en cherchant l'itndex dans la listBox1 ListBox3.Items.Add(ListBox1.Items(i).ToString.ToLower) Next i End If End Sub
Modifié par cartman16 le 21/10/2014 à 13:18
si j'ai mi 4 combobox c'est parce-que j'ai 4 listes d'item (sommaire différent) au chargement de la form 3 combobox son invisible une seul reste visible le changement de visibilité ce fait par des radiobouton (4)
je te donne mon adresse email envoi moi un mail que je puisse t'envoyer des screens de ma form réel car c'est un projet très personnel je peu pas publier sur le forum; enfin si tu est d'accort pour m'aider.
Merci pour tout ce que tu fait mille merci ;)
email: fortheworld@hotmail.fr
21 oct. 2014 à 14:00