my controls are not refreshing ?

i and i

New member
Joined
Aug 27, 2012
Messages
1
Programming Experience
3-5
Hello,

I have a form with a combobox on. When i click on the cbo I use the selectedindexchange event to refresh some data in my control:

VB.NET:
 Private Sub cboRecipeName_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles cboRecipeNames.SelectedIndexChanged        If xChangeLoadedRecipeAllowed Then
            If cboRecipeNames.SelectedIndex > -1 Then
                RecipeFromBook2Screen()
            Else
                cboRecipeNames.Text = 0
            End If
        End If
    End Sub

This works perfectly, in my sub RecipeFrombook2Screen is send the required info to the screen. Part of the code:

VB.NET:
 MessageBox.Show(oTempRecipe.sRecipeName)
        cboRecipeNames.Text = oTempRecipe.sRecipeName
        nudRecipeSteps.Value = oTempRecipe.iNbrSteps
        chkCycle.Checked = oTempRecipe.Cycle
        nudNrCycles.Value = oTempRecipe.iNrCycles
        txtTime.Text = oTempRecipe.iTime
        txtPressure.Text = oTempRecipe.iPressure
        txtcode.Text = oTempRecipe.scode
        MessageBox.Show(oTempRecipe.scode)

of course the messageboxes are shown, with the correct data and the controls are filled with the correct data.
The problem happens when I change the selectedindex of the cbo through code in an other function.

VB.NET:
  Public Sub changeRecipeThroughScanner(ByVal s As String)
        sCode = s
        TextBox1.Text = s
        Dim xFound As Boolean = False
        Dim iIndex As Integer = -1
        Do While Not xFound
            iIndex += 1
            Dim cboItem As clsCboItem
            cboItem = cboRecipeNames.Items(iIndex)
            If cboItem.ExtraInfo3.Equals(s) Then
                xFound = True
            End If
        Loop


        If xFound Then cboRecipeNames.SelectedIndex = iIndex
        ' RecipeFromBook2Screen()
    End Sub

The index is changed, so the selectedindexchanged event is fired, the messageboxes are appearing on my screen with the correct information, but the controls are not updating? But when I follow the function with debug, the correct information is send to the control. It is like they are not updating. Someone has an idea what can cause this?

kind regards,
Wesley
 
Back
Top