Click here to Skip to main content
15,887,898 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Prevent clicking on controls inside a groupbox without disabling Pin
Dave Kreskowiak26-Apr-14 3:07
mveDave Kreskowiak26-Apr-14 3:07 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
dilkonika26-Apr-14 4:06
dilkonika26-Apr-14 4:06 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
Dave Kreskowiak26-Apr-14 13:31
mveDave Kreskowiak26-Apr-14 13:31 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
dilkonika27-Apr-14 3:35
dilkonika27-Apr-14 3:35 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
Dave Kreskowiak27-Apr-14 6:45
mveDave Kreskowiak27-Apr-14 6:45 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
dilkonika27-Apr-14 7:47
dilkonika27-Apr-14 7:47 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
Dave Kreskowiak27-Apr-14 11:13
mveDave Kreskowiak27-Apr-14 11:13 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
dilkonika1-May-14 4:25
dilkonika1-May-14 4:25 
Hello !
I have implemented Imessage filter to resolve my case.
This is the class :
Imports System.Windows.Forms
Public Delegate Sub InsideDelegate(ByRef value As Boolean)
Public Class MyMessageFilter
    Implements IMessageFilter

    Public Event Inside As InsideDelegate

    Private Const WM_LBUTTONDOWN As Integer = &H201
    Private Const WM_LBUTTONUP As Integer = &H202

    Public Function PreFilterMessage(ByRef m As Message) As Boolean Implements IMessageFilter.PreFilterMessage

        Return OnInside()

    End Function

    Private Function OnInside() As Boolean
        Dim _inside As Boolean = True

        If InsideEvent IsNot Nothing Then
            InsideEvent(_inside)
        End If

        Return _inside
    End Function
End Class


This is the code on my form :
VB
Dim filter As New MyMessageFilter()
Private Flag1 As Boolean = True
Private Sub filter_Inside(ByRef value As Boolean)
    value = If((Groupbox1.ClientRectangle.Contains(Groupbox1.PointToClient(Control.MousePosition)) AndAlso Flag1), True, False)
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles Me.Load
    AddHandler filter.Inside, AddressOf filter_Inside
    Application.AddMessageFilter(filter)

End Sub


This works , but I have some problems :
1)
I have a main form with menu and several other forms. On one of this forms ( not main) I have implemented Imessage filter. But when I close this form , I get an error on this sub :

Private Sub filter_Inside(ByRef value As Boolean)
value = If((GroupBox1.ClientRectangle.Contains(GroupBox1.PointToClient(Control.MousePosition)) AndAlso Flag1), True, False)
End Sub

: An unhandled exception of type 'System.ObjectDisposedException' occurred in System.Windows.Forms.dll
Additional information: Cannot access a disposed object.

What can I do ?

2)
I have noticed a problem in a groupbox that have bound controls.
I have a button that delete records from this form.And if the last record is deleted , I set the flag1 for the GoupBox1 to true ( so not clickable).
but on runtime , when I delete the last record , the bound textboxes should become empty. But they become empty only when I move the mouse outside the groupbox1. ( I didn't have this problem before implementing Imessage filter for this groupcontrol )

What can I do ?

Thank you !
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
Dave Kreskowiak1-May-14 5:22
mveDave Kreskowiak1-May-14 5:22 
GeneralRe: Prevent clicking on controls inside a groupbox without disabling Pin
dilkonika1-May-14 6:15
dilkonika1-May-14 6:15 
Questionmerge column but no spaces between data [Solved] Pin
khei-chan00725-Apr-14 16:37
khei-chan00725-Apr-14 16:37 
AnswerRe: merge column but no spaces between data Pin
Peter Leow25-Apr-14 18:22
professionalPeter Leow25-Apr-14 18:22 
GeneralRe: merge column but no spaces between data Pin
khei-chan00725-Apr-14 19:40
khei-chan00725-Apr-14 19:40 
GeneralRe: merge column but no spaces between data Pin
Peter Leow25-Apr-14 21:22
professionalPeter Leow25-Apr-14 21:22 
QuestionORA-009000 Invalid SQL Statement when executing from code Pin
USAFHokie8025-Apr-14 1:28
USAFHokie8025-Apr-14 1:28 
AnswerRe: ORA-009000 Invalid SQL Statement when executing from code Pin
Simon_Whale25-Apr-14 1:47
Simon_Whale25-Apr-14 1:47 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
USAFHokie8025-Apr-14 1:49
USAFHokie8025-Apr-14 1:49 
SuggestionRe: ORA-009000 Invalid SQL Statement when executing from code Pin
Richard Deeming25-Apr-14 1:51
mveRichard Deeming25-Apr-14 1:51 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
USAFHokie8025-Apr-14 2:13
USAFHokie8025-Apr-14 2:13 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
Dave Kreskowiak25-Apr-14 2:41
mveDave Kreskowiak25-Apr-14 2:41 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
USAFHokie8025-Apr-14 2:54
USAFHokie8025-Apr-14 2:54 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
Dave Kreskowiak25-Apr-14 3:02
mveDave Kreskowiak25-Apr-14 3:02 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
USAFHokie8025-Apr-14 3:15
USAFHokie8025-Apr-14 3:15 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
Dave Kreskowiak25-Apr-14 6:28
mveDave Kreskowiak25-Apr-14 6:28 
GeneralRe: ORA-009000 Invalid SQL Statement when executing from code Pin
thatraja25-Apr-14 3:11
professionalthatraja25-Apr-14 3:11 

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.