Problem with modified Combobox class  
Author Message
iamdlpsr





PostPosted: Mon Oct 02 15:37:00 CDT 2006 Top

Visual Basic [VB] >> Problem with modified Combobox class

I've modified a combobox class so that it has a ReadOnly property.
When set to ReadOnly, the combobox can't be changed, but it doesn't
appear gray. I called the new class ComboLockBox and I've placed them
on a MDIChild form and they work great.

The problem is, I got a timer that looks for mouse activity and when
the mouse is idle for a set number of minutes, all MDIChild forms are
hidden and the Logon form is displayed.

When the user logs back on, the visible property of the forms is set
back to True. The ComboLockBox controls are no longer the modified
class I created, but are regular comboboxes and are grayed out.
Setting my ReadOnly property or the Enabled property of the boxes
doesn't change anything.

What's happening to my class?

Here's the code I use to hide the forms:

Try
For j = 0 To (Me.MdiChildren.Length) - 1
Dim tempChild As Form = CType(Me.MdiChildren(j), Form)
tempChild.Visible = False
Next
For i As Integer = 0 To My.Application.OpenForms.Count - 1
If My.Application.OpenForms(i).Name <> "frmMain" Then
My.Application.OpenForms(i).Visible = False
End If
Next
Catch
MsgBox(Err.Description, MsgBoxStyle.Critical, "AN ERROR
OCCURRED WHILE HIDING THE FORMS")
'do nothing
End Try


and this unhides the forms:

Dim m As System.Windows.Forms.Form

For Each m In My.Application.OpenForms
If m.Name <> "frmMain" Then
m.Visible = True
End If
Next m

For j = 0 To (Me.MdiChildren.Length) - 1
Dim tempChild As Form = CType(Me.MdiChildren(j), Form)
tempChild.Visible = True
Next

Visual Studio366  
 
 
rowe_newsgroups





PostPosted: Mon Oct 02 15:37:00 CDT 2006 Top

Visual Basic [VB] >> Problem with modified Combobox class Have you tried setting a condition breakpoint that fires when the
enabled or readonly property changes? That may lead to the source of
the problem.

Thanks,

Seth Rowe


> I've modified a combobox class so that it has a ReadOnly property.
> When set to ReadOnly, the combobox can't be changed, but it doesn't
> appear gray. I called the new class ComboLockBox and I've placed them
> on a MDIChild form and they work great.
>
> The problem is, I got a timer that looks for mouse activity and when
> the mouse is idle for a set number of minutes, all MDIChild forms are
> hidden and the Logon form is displayed.
>
> When the user logs back on, the visible property of the forms is set
> back to True. The ComboLockBox controls are no longer the modified
> class I created, but are regular comboboxes and are grayed out.
> Setting my ReadOnly property or the Enabled property of the boxes
> doesn't change anything.
>
> What's happening to my class?
>
> Here's the code I use to hide the forms:
>
> Try
> For j = 0 To (Me.MdiChildren.Length) - 1
> Dim tempChild As Form = CType(Me.MdiChildren(j), Form)
> tempChild.Visible = False
> Next
> For i As Integer = 0 To My.Application.OpenForms.Count - 1
> If My.Application.OpenForms(i).Name <> "frmMain" Then
> My.Application.OpenForms(i).Visible = False
> End If
> Next
> Catch
> MsgBox(Err.Description, MsgBoxStyle.Critical, "AN ERROR
> OCCURRED WHILE HIDING THE FORMS")
> 'do nothing
> End Try
>
>
> and this unhides the forms:
>
> Dim m As System.Windows.Forms.Form
>
> For Each m In My.Application.OpenForms
> If m.Name <> "frmMain" Then
> m.Visible = True
> End If
> Next m
>
> For j = 0 To (Me.MdiChildren.Length) - 1
> Dim tempChild As Form = CType(Me.MdiChildren(j), Form)
> tempChild.Visible = True
> Next