Click here to Skip to main content
15,897,718 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Compare Two ListBoxes Pin
DaveAuld1-Apr-09 21:24
professionalDaveAuld1-Apr-09 21:24 
GeneralRe: Compare Two ListBoxes Pin
kjalandoon1-Apr-09 21:42
kjalandoon1-Apr-09 21:42 
Questionvb.net dataset object being exported and formatted in excel Pin
jazzgirl1-Apr-09 17:13
jazzgirl1-Apr-09 17:13 
Questionserious problem need serious help Ö Pin
udikantz1-Apr-09 16:42
udikantz1-Apr-09 16:42 
AnswerRe: serious problem need serious help Ö Pin
Luc Pattyn2-Apr-09 5:08
sitebuilderLuc Pattyn2-Apr-09 5:08 
GeneralRe: serious problem need serious help Ö Pin
Mehdi_S3-Sep-09 4:03
Mehdi_S3-Sep-09 4:03 
GeneralRe: serious problem need serious help Ö Pin
Luc Pattyn3-Sep-09 5:13
sitebuilderLuc Pattyn3-Sep-09 5:13 
QuestionsGrid2: Stop Resizing the Header when Column Width is out of range of Max width or Min Width Pin
VBAdvisor1-Apr-09 15:42
VBAdvisor1-Apr-09 15:42 
Can you tell me how to Stop Resizing the VBAccelerator’s sGrid2 http://www.vbaccelerator.com/home/VB/Code/Controls/S_Grid_2/index.asp[^] Header when Column Width is out of range of Max width or Min Width?

When reaching the boundary of Max or Min Column Width, mouse don’t allow to move further to over the limits. I am trying to sendMessage when reach the end point but doesn’t work.

I can’t use bHandled = True when reaching the boundary, it will cancel the resizing action. I want to STOP resizing and mouse don’t allow to move further when reaching the boundary.

If lHDI(1) < m_lMinWidth(tHDN.iItem) And Not m_lMinWidth(tHDN.iItem) = -1 Then
lReturn = 1
bHandled = True
End If
If lHDI(1) > m_lMaxWidth(tHDN.iItem) And Not m_lMaxWidth(tHDN.iItem) = -1 Then
lReturn = 1
bHandled = True
End If
RaiseEvent StartColumnWidthChange(tHDN.iItem, lHDI(1), bCancel)
If bCancel Then
lReturn = 1
bHandled = True
End If

Here are the sGrid2 clsHeaderControl Subclass Code:

Private Sub myWndProc(ByVal bBefore As Boolean, _
                      ByRef bHandled As Boolean, _
                      ByRef lReturn As Long, _
                      ByVal lng_hWnd As Long, _
                      ByVal uMsg As Long, _
                      ByVal wParam As Long, _
                      ByVal lParam As Long, _
                      ByRef lParamUser As Long)
 
Dim tNMH                        As NMHDR
Dim tHDN                        As NMHEADER
Dim lHDI()                      As Long
Dim bCancel                     As Boolean
Dim bForceManualDragDrop        As Boolean
Dim sFilter                     As String
Dim sx                          As Single
Dim sy                          As Single
Dim tP                          As POINTAPI
Dim tGRedraw                    As NMLVCUSTOMDRAW
 
    Select Case lParamUser
    Case exParentWindows
        Select Case uMsg
        Case &H4E 'WM_NOTIFY
            CopyMemory tNMH, ByVal lParam, LenB(tNMH)
            Select Case tNMH.code
            Case HDN_BEGINTRACKA, HDN_BEGINTRACKW
                CopyMemory tHDN, ByVal lParam, Len(tHDN)
                '/* Get HD_ITEM from tHDN.lPtrHDItem.  Don't use a HD_ITEM
                '/* structure - you will crash...
                '/* Here we only need up to the second long (HD_ITEM.cxy)
                ReDim lHDI(0 To 1) As Long
                CopyMemory lHDI(0), ByVal tHDN.lPtrHDItem, 8
                '/* Check if this column is grouped:
                If m_bAllowGrouping Then
                    If ColumnIsGrouped(tHDN.iItem) Then
                        '/* Don't allow it to be sized
                        lReturn = 1
                        bHandled = True
                        Exit Sub
                    End If
                End If
                
                If lHDI(1) < m_lMinWidth(tHDN.iItem) And Not m_lMinWidth(tHDN.iItem) = -1 Then
                  ‘ <big>do something???</big>
                End If
                If lHDI(1) > m_lMaxWidth(tHDN.iItem) And Not m_lMaxWidth(tHDN.iItem) = -1 Then
                   ‘ <big>do something???</big>
                End If
                   RaiseEvent StartColumnWidthChange(tHDN.iItem, lHDI(1), bCancel)
                If bCancel Then
                    lReturn = 1
                    bHandled = True
                End If
 
            Case HDN_TRACKA, HDN_TRACKW
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                '/* Get HD_ITEM from tHDN.lPtrHDItem.  Don't use a HD_ITEM
                '/* structure - you will crash...
                '/* Here we only need up to the second long (HD_ITEM.cxy)
                ReDim lHDI(0 To 1) As Long
                CopyMemory lHDI(0), ByVal tHDN.lPtrHDItem, 8
                If lHDI(1) < m_lMinWidth(tHDN.iItem) And Not m_lMinWidth(tHDN.iItem) = -1 Then
                  ‘ <big>do something???</big>
                End If
                If lHDI(1) > m_lMaxWidth(tHDN.iItem) And Not m_lMaxWidth(tHDN.iItem) = -1 Then
                  ‘ <big>do something???</big>
                End If
                RaiseEvent ColumnWidthChanging(tHDN.iItem, lHDI(1), bCancel)
                If bCancel Then
                    lReturn = 1
                    bHandled = True
                End If
                                
            Case HDN_ENDTRACKA, HDN_ENDTRACKW
                lReturn = m_NGSubclass.ssc_CallOrigWndProc(lng_hWnd, uMsg, wParam, lParam)
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                If m_bAllowGrouping Then
                    If ColumnIsGrouped(tHDN.iItem) Then
                        '/* No events
                        Exit Sub
                    End If
                End If
                '/* Get HD_ITEM from tHDN.lPtrHDItem.  Don't use a HD_ITEM
                '/* structure - you will crash...
                '/* Here we only need up to the second long (HD_ITEM.cxy)
                ReDim lHDI(0 To 1) As Long
                CopyMemory lHDI(0), ByVal tHDN.lPtrHDItem, 8
                m_lCol = tHDN.iItem
                m_lCXY = lHDI(1)
                RaiseEvent ColumnWidthChanged(tHDN.iItem, lHDI(1))
                m_lCol = -1
                                
            Case HDN_DIVIDERDBLCLICKA, HDN_DIVIDERDBLCLICKW
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                RaiseEvent DividerDblClick(tHDN.iItem, m_bFixedWidth(tHDN.iItem)) '// bFixedWidth option
                
            Case HDN_ITEMCLICKA, HDN_ITEMCLICKW
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                RaiseEvent ColumnClick(tHDN.iItem, pvShiftState) '// for multi-Sorting function 27-dec-2007
               
            Case HDN_ITEMDBLCLICKA, HDN_ITEMDBLCLICKW
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                RaiseEvent ColumnDblClick(tHDN.iItem)
 
            Case HDN_BEGINDRAG
                If m_bPreventDrag Then
                    lReturn = 1
                    bHandled = True
                Else
                    CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                    RaiseEvent ColumnHeaderBeginDrag(tHDN.iItem, bCancel)
                    If bCancel Then
                        m_bPreventDrag = True
                        m_lCol = -1
                        lReturn = 1
                        bHandled = True
                    ElseIf (m_bAllowGrouping And Not (m_bHideGroupingBox)) Then
                        m_iDragCol = tHDN.iItem
                        PostMessage m_hWnd, UM_STARTDRAG, 0, 0
                        lReturn = 1
                        bHandled = True
                    End If
                End If
                       
            Case HDN_ENDDRAG
                  CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                   '/* Get HD_ITEM from tHDN.lPtrHDItem.  Don't use a HD_ITEM
                   '/* structure - you will crash...
                   '/* Here we only need up to the ninth long (HD_ITEM.iOrder)
                   ReDim lHDI(0 To 8) As Long
                   CopyMemory lHDI(0), ByVal tHDN.lPtrHDItem, 36
                   SendMessage m_hWnd, &H200, 0, &H7FFF7FFF  '//Zhu reset dragged state by sending a WM_MouseMove event before RaiseEvent
                   RaiseEvent ColumnHeaderEndDrag(tHDN.iItem, lHDI(8), bCancel)  '// added bCancel on 10-jan-2008
                   If (bCancel) Then
                      lReturn = 1
                      bHandled = True  'Prevent Drop
                  Else
                    lReturn = m_NGSubclass.ssc_CallOrigWndProc(lng_hWnd, uMsg, wParam, lParam)
                    'CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                    '/* Get HD_ITEM from tHDN.lPtrHDItem.  Don't use a HD_ITEM
                    '/* structure - you will crash...
                    '/* Here we only need up to the ninth long (HD_ITEM.iOrder)
                    'ReDim lHDI(0 To 8) As Long
                   'CopyMemory lHDI(0), ByVal tHDN.lPtrHDItem, 36
                   '/* Check for cancel:
                      If lHDI(8) > -1 Then
                         m_lCol = -1
                         PostMessage m_hWnd, UM_ENDDRAG, tHDN.iItem, lHDI(8)
                      End If
                   End If
                   m_lCol = -1
 
            Case HDN_FILTERBTNCLICK
                '/* Get NMHDFILTERBTNCLICK.  Only require NMHDR + 1
                CopyMemory tHDN, ByVal lParam, 16
                RaiseEvent ColumnFilterClick(tHDN.iItem)
 
            Case HDN_FILTERCHANGE
                '/* Filter change.  Don't get details of the item in
                '/* this event, so need to call GetItem..
                CopyMemory tHDN, ByVal lParam, LenB(tHDN)
                sFilter = ColumnFilter(tHDN.iItem)
                RaiseEvent ColumnFilterChange(tHDN.iItem, sFilter)
 
            Case NM_RCLICK
                '/* Right click in control
                GetCursorPos tP
                ScreenToClient m_hWnd, tP
                sx = tP.x
                sy = tP.y + m_tR.top
                RaiseEvent RightClick(sx, sy)
 
            Case NM_RELEASEDCAPTURE
                '/* End of stop dragging mode:
                m_bPreventDrag = False
                
                '/*** added
            Case NM_CUSTOMDRAW
                CopyMemory tGRedraw, ByVal lParam, Len(tGRedraw)
                If tGRedraw.nmcmd.dwDrawStage = CDDS_PREPAINT Then
                    lReturn = CDRF_NOTIFYITEMDRAW
                    bHandled = True
                    Exit Sub
                End If
 
                If tGRedraw.nmcmd.dwDrawStage = CDDS_ITEMPREPAINT Then
                    SetTextColor tGRedraw.nmcmd.hDC, m_oHdrTextClr
                    SetBkColor tGRedraw.nmcmd.hDC, m_oHdrBkClr
                Else
                    lReturn = CDRF_DODEFAULT
                    bHandled = True
                    Exit Sub
                End If
 
                If tGRedraw.nmcmd.dwDrawStage = CDDS_ITEMPOSTPAINT Then
                    lReturn = CDRF_DODEFAULT
                    bHandled = True
                    Exit Sub
                End If
            End Select
        End Select
End Sub

AnswerRe: sGrid2: Stop Resizing the Header when Column Width is out of range of Max width or Min Width Pin
VBAdvisor1-Apr-09 20:49
VBAdvisor1-Apr-09 20:49 
GeneralRe: sGrid2: Stop Resizing the Header when Column Width is out of range of Max width or Min Width Pin
VBAdvisor4-Apr-09 13:46
VBAdvisor4-Apr-09 13:46 
QuestionHow to read the public class name into a string Pin
C#Coudou1-Apr-09 14:23
C#Coudou1-Apr-09 14:23 
AnswerRe: How to read the public class name into a string Pin
Tom Deketelaere1-Apr-09 21:07
professionalTom Deketelaere1-Apr-09 21:07 
Questionunrardll referencing problem Pin
vaughan5121-Apr-09 11:07
vaughan5121-Apr-09 11:07 
AnswerRe: unrardll referencing problem Pin
Dave Kreskowiak2-Apr-09 5:39
mveDave Kreskowiak2-Apr-09 5:39 
GeneralRe: unrardll referencing problem Pin
vaughan5122-Apr-09 22:29
vaughan5122-Apr-09 22:29 
QuestionEnsureVisible in TreeView: how to ensure that horiz. scrollbar is aligned left Pin
mp00011-Apr-09 10:45
mp00011-Apr-09 10:45 
AnswerRe: EnsureVisible in TreeView: how to ensure that horiz. scrollbar is aligned left [modified] Pin
Henry Minute1-Apr-09 12:41
Henry Minute1-Apr-09 12:41 
GeneralRe: EnsureVisible in TreeView: how to ensure that horiz. scrollbar is aligned left Pin
mp00017-Apr-09 5:31
mp00017-Apr-09 5:31 
QuestionDatabase + listbox with image or icon example Pin
wgarnett1-Apr-09 5:53
wgarnett1-Apr-09 5:53 
AnswerRe: Database + listbox with image or icon example Pin
Henry Minute1-Apr-09 10:35
Henry Minute1-Apr-09 10:35 
GeneralRe: Database + listbox with image or icon example Pin
wgarnett1-Apr-09 15:24
wgarnett1-Apr-09 15:24 
AnswerRe: CROSSPOST DO NOT REPLY!! Pin
Henry Minute2-Apr-09 11:32
Henry Minute2-Apr-09 11:32 
GeneralRe: CROSSPOST DO NOT REPLY!! Pin
wgarnett2-Apr-09 16:40
wgarnett2-Apr-09 16:40 
GeneralRe: CROSSPOST DO NOT REPLY!! Pin
wgarnett3-Apr-09 21:00
wgarnett3-Apr-09 21:00 
Questionvb.net dll and web page Pin
rmedo1-Apr-09 1:09
rmedo1-Apr-09 1:09 

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.