| | |
To position textbox scrollbar at bottom of text
![]() |
vb Syntax (Toggle Plain Text)
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Const WM_VSCROLL = &H115 Const SB_BOTTOM = 7 Private Sub Text1_Change() SendMessage Text1.hwnd, WM_VSCROLL, SB_BOTTOM, 0 End Sub
•
•
Join Date: Feb 2008
Posts: 198
Reputation:
Solved Threads: 0
My application is developed in MS Access using VB. I have a form having multiple textboxes and other controls. Running the code for setting the scrollbar to the end is not working here and throws up an error saying "Object doesn't support this property or method." on line :
SavedWnd = Screen.ActiveControl.hwnd
The code is working in a separate VB application which has a single text box and a button.
Please suggest what could be the solution for this. I think hwnd is not being recognized. Is there any reference which needs to be included to run the same code?
SavedWnd = Screen.ActiveControl.hwnd
The code is working in a separate VB application which has a single text box and a button.
Please suggest what could be the solution for this. I think hwnd is not being recognized. Is there any reference which needs to be included to run the same code?
Well, Visual Basic and VBA (Visual Basic For Applications) are NOT the same. Visual Basic (And This Forum is VB 4/5/6, NOT .Net, which is also different [ie: VB express, VB 2005, VB 2008, etc]). That said, code that would often work in VB 6, such as the code I posted with sendmessage, will not work if you are in VBA (VB inside of Access). Now, you could normally get away with selecting and deselecting the listbox in Access, like so:
I believe I also read somewhere that you can pass the DESC sql key word to make it sort the data in the listbox by descending order, which automatically scrolls the listbox... but I haven't tried that.
vb Syntax (Toggle Plain Text)
Me.mylistbox.Selected(Me.mylistbox.ListCount - 1) = True Me.mylistbox.Selected(Me.mylistbox.ListCount - 1) = False
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: POS Printer programming with OPOSPOSPrinter.ocx
- Next Thread: help data storing and genrating soft
| Thread Tools | Search this Thread |
* 6 2007 access activex add age basic beginner birth bmp calculator cd cells.find click client code college connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit excel excelmacro file filename form header iamthwee image inboxinvb internetfiledownload listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading remotesqlserverdatabase report save search sendbyte sites sql sql2008 sqlserver subroutine tags time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web windows






