|
-
Aug 19th, 2003, 12:01 PM
#1
Thread Starter
Addicted Member
Textbox Scrollbar
I am adding data to a multiline text box when data is arrived from a socket where the new text is on the bottom, I kno I can use
textbox.text += newtext;
textbox.SelectionStart = textbox.text.length;
but the textbox has to have focus plus it makes the screen flicker when it does it, both I do have
someone told me to use api's to lock the scrollbar but I haven't used api's that much
does anyone kno what api i need to use to do this an how do i use it?
-
Aug 20th, 2003, 05:36 AM
#2
Hi Tewl good to see you on ere
right i'm guessing that the textbox isnt scrolling down to show the latest data thats been added ( like it normally does in vb6 )
you need to set the textbox's HideSelection property to False, eg:
VB Code:
[COLOR=BLUE]private[/COLOR] [COLOR=BLUE]void[/COLOR] Form1_Load([COLOR=BLUE]object[/COLOR] sender, System.EventArgs e)
{
textBox1.HideSelection=[COLOR=BLUE]false[/COLOR]; [COLOR=GREEN]/// make the textbox scroll as it should, when it fills up
[/COLOR]}
[COLOR=BLUE]private[/COLOR] [COLOR=BLUE]void[/COLOR] AddData([COLOR=BLUE]string[/COLOR] strData)
{
textBox1.AppendText(strData); [COLOR=GREEN]/// puts the text at the end of the exsisting stuff.
[/COLOR]}
hope it helps you out m8y
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Aug 20th, 2003, 03:06 PM
#3
Thread Starter
Addicted Member
thx m8 thats just what i needed
-
Aug 20th, 2003, 10:14 PM
#4
Thread Starter
Addicted Member
Maybe you can answer one more question for me.
When i minimize the app for awhile then restore it later on the textbox seems like it has scrolled down a bit to where i cant see any text thats at the top any ideas y an how i should fix this ;\
-
Aug 21st, 2003, 09:03 AM
#5
sorry for the delay m8, my twin babies have come home, so i'm not gonna be on my pc much now. if you want to show the last line ( eg , scroll to the end ) when the form comes back from minimized, try this...
VB Code:
[COLOR=BLUE]private[/COLOR] [COLOR=BLUE]void[/COLOR] Form1_Resize([COLOR=BLUE]object[/COLOR] sender, System.EventArgs e)
{
[COLOR=BLUE]if[/COLOR]([COLOR=BLUE]this[/COLOR].WindowState!=FormWindowState.Minimized)
{
textBox1.ScrollToCaret();
}
}
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Aug 21st, 2003, 06:56 PM
#6
Thread Starter
Addicted Member
still doin it m8
it also does this when i maximize the form leavin some of the text higher up an a huge chunk of white space at the bottom
-
Aug 21st, 2003, 07:17 PM
#7
Thread Starter
Addicted Member
nvm itchy told me how to use the sendmessage to do it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|