473,888 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form auto scrolling issue

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

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
..SelectionStar t is no longer visible to the user. But .SelectionStart must
remain visible, and (I assume) that means I must programmaticall y 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 .AutoScrollPosi tion 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 programmaticall y.

Is there any way I can manually override this behavior and force the form,
programmaticall y, 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 programmaticall y
scroll beyond it?
Nov 21 '05 #1
0 2253

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

Similar topics

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" scrolling="no"> <FRAME src="rundetails.asp" name="rundetails" scrolling="auto"> <FRAME src="rundetailsbottom.asp" name="rundetailsbottom" scrolling="no"> </FRAMESET>
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 open page2.asp. But I dont want to make page2.asp invisible. Any ideas?? Is it possible? Please advise. Thanks!!
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 screen by moving a picturebox (sprite) with the cursor keys. When the user hits the bottom of the screen I want the screen to automatically scroll down to keep the picture box in view - The screen
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 enough, right? e.g. this successfully sets the local form's field: document.thetestform.mycity.value='paris';
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 screen by moving a picturebox (sprite) with the cursor keys. When the user hits the bottom of the screen I want the screen to automatically scroll down to keep the picture box in view - The screen
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 contain images. I want
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 the cursor is not visible. If I manually use the scroll bar to position so I can see the cursor and press tab again, it again scrolls up to almost the top of the form. why?? Bob
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 line BTW I am ahort of form real estate and I know that I can run the form maximized but I want to design it so that no elements are cut off
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 that as I type in the the first two or three numbers of the product code in the textbox, the first product code record appears at the top of the form. I would like the continuous form to act like a combox with auto expand. Thanks!
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.