Hello,
I have a project with multiple forms. One form (Form A) contains a panel which contains many other controls. I have another form (Form B) that calls a function in Form A. The function in Form A uses a For Each loop which loops through the controls in Form A and does stuff to them.
Unfortunitely, this isn't working. Any suggestions?
VB Code:
'----------------------- ' Form B '----------------------- Dim Answer As String = MsgBox("Are you sure you want to remove ALL images from the transfer list?", MsgBoxStyle.YesNo) If Answer = vbYes Then frmMain.UploadArray = myImgArray Call frmMain.RemoveAllImages() End If Answer = NothingVB Code:
' ------------------------------------------------------- ' Form A - Referred to in Form B as frmMain ' ------------------------------------------------------- Public Sub RemoveAllImages() If Not UploadArray Is Nothing Then 'loop througn all controls in Panel1 and set bgcolor to transparent Me.Focus() Dim pnlCtl As Control For Each pnlCtl In Me.Panel1.Controls pnlCtl.BackColor = Color.Transparent pnlCtl.ForeColor = ForeColor.Black pnlCtl.Controls(0).ForeColor = ForeColor.Black Next ' Clear the upload Array UploadArray = Nothing 'Update View Selected Images Form If Not frmViewSelected Is Nothing Then frmViewSelected.myImgArray = UploadArray frmViewSelected.DisplayImageArray(UploadArray) End If stBarSelImgs.Text = "Selected Images: 0" Me.Refresh() End If End Sub
Thanks for any suggestions.




Reply With Quote