To position textbox scrollbar at bottom of text

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 198
Reputation: dinilkarun is an unknown quantity at this point 
Solved Threads: 0
dinilkarun dinilkarun is offline Offline
Junior Poster

To position textbox scrollbar at bottom of text

 
0
  #1
Jan 12th, 2009
Please help me in positioning the scroll bar at the bottom of text.
Please help me by providing the code snippet.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1
Reputation: svg77 is an unknown quantity at this point 
Solved Threads: 0
svg77 svg77 is offline Offline
Newbie Poster

Re: To position textbox scrollbar at bottom of text

 
0
  #2
Jan 12th, 2009
Will this do?
Text1.SelStart = Len(Text1.Text)
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 198
Reputation: dinilkarun is an unknown quantity at this point 
Solved Threads: 0
dinilkarun dinilkarun is offline Offline
Junior Poster

Re: To position textbox scrollbar at bottom of text

 
0
  #3
Jan 12th, 2009
no
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: To position textbox scrollbar at bottom of text

 
0
  #4
Jan 12th, 2009
  1. 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
  2. Const WM_VSCROLL = &H115
  3. Const SB_BOTTOM = 7
  4.  
  5. Private Sub Text1_Change()
  6. SendMessage Text1.hwnd, WM_VSCROLL, SB_BOTTOM, 0
  7. End Sub
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 198
Reputation: dinilkarun is an unknown quantity at this point 
Solved Threads: 0
dinilkarun dinilkarun is offline Offline
Junior Poster

Re: To position textbox scrollbar at bottom of text

 
0
  #5
Jan 16th, 2009
the code is giving error!!!1

Please help any other alternative.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: To position textbox scrollbar at bottom of text

 
0
  #6
Jan 16th, 2009
that's how it's done.... maybe you put the code in the wrong place.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 198
Reputation: dinilkarun is an unknown quantity at this point 
Solved Threads: 0
dinilkarun dinilkarun is offline Offline
Junior Poster

Re: To position textbox scrollbar at bottom of text

 
0
  #7
Jan 21st, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: To position textbox scrollbar at bottom of text

 
0
  #8
Jan 21st, 2009
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:
  1. Me.mylistbox.Selected(Me.mylistbox.ListCount - 1) = True
  2. Me.mylistbox.Selected(Me.mylistbox.ListCount - 1) = False
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC