Click here to Skip to main content
15,911,306 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Problems with default DataGridView Pin
Luc Pattyn11-Feb-12 5:10
sitebuilderLuc Pattyn11-Feb-12 5:10 
AnswerRe: Problems with default DataGridView Pin
Sonhospa13-Feb-12 2:13
Sonhospa13-Feb-12 2:13 
QuestionSpareRoom(VBPmanan15) Pin
manan112211-Feb-12 3:00
manan112211-Feb-12 3:00 
AnswerRe: SpareRoom(VBPmanan15) Pin
Eddy Vluggen11-Feb-12 3:33
professionalEddy Vluggen11-Feb-12 3:33 
QuestionSynchronized controls logic Pin
Sonhospa11-Feb-12 0:41
Sonhospa11-Feb-12 0:41 
AnswerRe: Synchronized controls logic Pin
Luc Pattyn11-Feb-12 2:17
sitebuilderLuc Pattyn11-Feb-12 2:17 
QuestionRe: Synchronized controls logic Pin
Sonhospa11-Feb-12 15:18
Sonhospa11-Feb-12 15:18 
AnswerRe: Synchronized controls logic Pin
Luc Pattyn11-Feb-12 15:47
sitebuilderLuc Pattyn11-Feb-12 15:47 
You should keep things simple, especially when you don't understand them well.
And not knowing the basics of generic lists is not acceptable nowadays!

Here is a demo class to describe the combobox items:
VB
Public Class Item
    Private myValue As Integer
    Private myName As String

    Public Sub New(ByVal number As Integer, ByVal name As String)
        myValue = number
        myName = name
    End Sub

    Public ReadOnly Property Valu() As Integer
        Get
            Return myValue
        End Get
    End Property

    Public ReadOnly Property Name() As String
        Get
            Return myName
        End Get
    End Property
End Class


and this could be part of a Form that holds a number of comboboxes, all showing the same list, and working fully synchronized:
VB
Private Items As List(Of Item)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Items = New List(Of Item)
    Items.Add(New Item(1, "one"))
    Items.Add(New Item(2, "two"))
    Items.Add(New Item(3, "three"))
    For Each ctrl As Control In Me.Controls
        If TypeOf (ctrl) Is ComboBox Then
            Dim cmb As ComboBox = CType(ctrl, ComboBox)
            cmb.DataSource = Items
            cmb.DisplayMember = "Name"
            cmb.ValueMember = "Valu"
        End If
    Next
End Sub


That is all there is to it. No magic, no wizards involved.

PS: when you attach a SelectedValueChanged handler to each ComboBox, you'll see they all fire, the one you actually changed fires first, then the others in arbitrary order.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.

QuestionRe: Synchronized controls logic Pin
Sonhospa11-Feb-12 23:36
Sonhospa11-Feb-12 23:36 
AnswerRe: Synchronized controls logic Pin
Luc Pattyn12-Feb-12 0:04
sitebuilderLuc Pattyn12-Feb-12 0:04 
GeneralRe: Synchronized controls logic Pin
Sonhospa12-Feb-12 1:35
Sonhospa12-Feb-12 1:35 
QuestionOLE Automation error 438 when registering a XLL using custom action Pin
tagad10-Feb-12 6:17
tagad10-Feb-12 6:17 
QuestionHow do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Jörgen Andersson9-Feb-12 22:33
professionalJörgen Andersson9-Feb-12 22:33 
AnswerRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Luc Pattyn9-Feb-12 23:36
sitebuilderLuc Pattyn9-Feb-12 23:36 
GeneralRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Jörgen Andersson9-Feb-12 23:47
professionalJörgen Andersson9-Feb-12 23:47 
GeneralRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Luc Pattyn9-Feb-12 23:59
sitebuilderLuc Pattyn9-Feb-12 23:59 
AnswerRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Dave Kreskowiak10-Feb-12 2:11
mveDave Kreskowiak10-Feb-12 2:11 
GeneralRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Jörgen Andersson10-Feb-12 3:05
professionalJörgen Andersson10-Feb-12 3:05 
GeneralRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
Dave Kreskowiak10-Feb-12 3:33
mveDave Kreskowiak10-Feb-12 3:33 
AnswerRe: How do I check programmatically if installed version of ACE OleDb is 64 or 32 bit version? Pin
yanghua9414-Feb-12 5:42
yanghua9414-Feb-12 5:42 
QuestionvsFlexgrid 8 ActiveX Pin
Jim Giles9-Feb-12 10:39
Jim Giles9-Feb-12 10:39 
QuestionWhat should i install ? Pin
alejx9-Feb-12 3:55
alejx9-Feb-12 3:55 
AnswerRe: What should i install ? Pin
Simon_Whale9-Feb-12 4:22
Simon_Whale9-Feb-12 4:22 
GeneralRe: What should i install ? Pin
alejx9-Feb-12 7:23
alejx9-Feb-12 7:23 
GeneralRe: What should i install ? Pin
Framework .l.9-Feb-12 14:18
Framework .l.9-Feb-12 14:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.