473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Form auto scrolling issue

23s
Is there any way I can send a vertical value to a form's scroll position?

I have a full-screen form that, at launch, contains an empty tab sheet.

At run time, the user can dynamically append a rich textbox to the tab
sheet. The rich textbox is placed at 0,0 (upper left corner) within the tab
sheet and is initially 1 "line" tall to accomodate the user's first line of
text.

The rich text box is, in actuality, a user control of mine that resizes
itself to always "fit" whatever the user has typed into it, so that all text
they have typed is visible at all times, without inducing scrollbars on the
rich textbox (while maintaining the minimum possible vertical size). In
essence, the rich textbox height is consistantly equivalent to "number of
lines * however tall your font is" (although that's not the exact equation,
that's the net visual result).

A routine exists that resizes the tab sheet in a similar fashion; to "fit"
perfectly around the rich textbox. Every time the rich textbox decides it
needs to resize because the number of lines has changed, it fires the
routine on the form that resizes the tab sheet to fit perfectly around the
rich textbox (vertically).

So in virtual tandum, my rich textbox and my tabsheet resize themselves in
reaction to however many lines are in the rich textbox, in real time as the
user types.

I need to maintain visibility of the .SelectionStart position of the rich
textbox at all times. Which is a true condition by default, until the user
has typed quite a bit of stuff, and produced more lines than fit on the
maximized form at the current screen resolution. At that point, the rich
textbox is quite tall, the tab sheet is now quite tall, and the vertical
auto-scrolling of the form kicks in to accomodate the tall tab sheet. And
this is desireable behavior. However, the form will curiously not
auto-scroll beyond the "top" of the rich textbox; and consequently, I can
type and type further and further down "off the screen"; my rich textbox is
resizing correctly, the tab sheet is resizing correctly, but because the
form is suddenly stubborn in how far down it will scroll, the
..SelectionStart is no longer visible to the user. But .SelectionStart must
remain visible, and (I assume) that means I must programmatically scroll the
form downwards. No problem, or so I thought. After the "resize the tab
sheet" operation, I need to check to see if I need to "scroll the form down,
to keep .SelectionStart in view" but I can't figure out how to accomplish
that yet.

I tried the .ScrollToCaret method of the rich textbox itself, however within
the context of the rich textbox, there are no scroll bars, ergo nowhere to
scroll. As far as it's concerned, it's already scrolled to everywhere. The
problem is with the scrollbars on the form, and not the rich textbox.

Next I tried the .AutoScrollPosition of the form, but that doesn't seem to
be remedying the problem either - it also seems obliged to stop scrolling as
soon as the top of the rich textbox reaches vertical position 0 on the form,
and the scrolling halts there. I can manuall scroll it with the scroll bars
at runtime, but I need to do this programmatically.

Is there any way I can manually override this behavior and force the form,
programmatically, to scroll down beyond the top of the rich textbox? Why is
it stopping at the top of the rich textbox and how can I programmatically
scroll beyond it?
Nov 21 '05 #1
0 2205

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kathryn | last post by:
I hope you can help as this is driving me crazy! I have an asp which has 3 frames on it as follows: <FRAMESET rows="50%,*,10%"> <FRAME src="rundetailstop.asp" name="rundetailstop"...
6
by: Matt | last post by:
Is it possible to post form data and open an invisible window? For example, in page1.as <form action="page2.asp" method="POST" It will post the form data from page1.asp to the server, and...
3
by: Scott M | last post by:
Hi, I am currently trying to write a simple game using vb.net the form I am working on is 800*600 (this is set as the maximum size) and autoscroll is set to true. The user moves around the...
3
by: Bob | last post by:
I'm a total newbie at Javascript, but a programmer for over 20 years... so, my plans may be bigger than they are possible. I'm trying to set with Javascript the value of a form field... easy...
0
by: Scott M | last post by:
Hi, I am currently trying to write a simple game using vb.net the form I am working on is 800*600 (this is set as the maximum size) and autoscroll is set to true. The user moves around the...
0
by: WayneB | last post by:
Hi I am trying to create a web form of the following structure <Header/> <Middle> <Nav Panel/><Content Panel/> </Middle> <Footer/> The header and footer will be fixed size as they will...
1
by: Bob Alston | last post by:
I have a form that is longer than the screen height. If I am positioned on the form, where I have had to scroll down a bit. When I press tab the form scrolls up so that the current location of...
2
by: New | last post by:
This may be a dumb question but what is the largest size you would recommend a form to be if it is designed to work in a 1024 x 768 enviroment since some peopl have the taskbar set greater then one...
2
by: Steve | last post by:
I have a continuous form showing Product Code and Product Name. Product Code is five digits and is sequential. I have a textbox in the form header. What is the code to scroll the continuous form so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.