Library tutorials & articles
TextBox Control
By James Crowley, published on 14 Jul 2001
Introduction
You can use the text box to get text from the user. Below shows you what a text box looks like
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
Hi,
In my C# application there is a multiline textbox with vertical scrollbar. When the multiline textbox get updated with new data, the vertical scrollbar flickers (from top to bottom) with each update on the textbox. How can I prevent the scrollbar flickering when the multiline textbox get updated each time.
Thanking you in advance.
Bishnu
Private Sub optSelect_Click()
' place the insertion point at the beginning
txtDisplay.SelStart = 0
' find the length of the string and
' select that number of characters
txtDisplay.SelLength = Len(txtDisplay.Text)
' set the focus to the text box so we can see
' the result of our settings
txtDisplay.SetFocus
End Sub
Hope it helps.
I found this code in the controls.vbp located in the MSDN Samples VB 98 folder
You can put this in the gotFocus event... like so
text1.SelStart = 0
tex1.SelLength = Len(text1.Text)
End Sub
h0pe this helps javascript:smilie('
big grin
Hello all
I am doing my project in asp.net . when a page gets loaded at that time i dont want a image control lie beside the taxtbox. but whenever a textbox got the focus , the image control should come beside the textbox. I dont know how to do this as in asp.net textbox don't have any Gotfocus() event.
Please help me , it's very urgent....
Hi, sorry but Newbie here,
From an excel workbook I want to display the data from cell A1 & B1 next to each other in a textbox in my Visual Basic 6 project. Then next line A2 & B2 and so on. I've got as far a displaying it in a list but not how I want it,
thank you
I have hit a dead stop.
(although while typing this I thought of a book and now about something which I guess will be called en_vscroll)
I'm still asking though because this may not be the answer and I'm sure going to struggle with this anyway.
I need to provide my own scrollbar for textboxes. Yes, this is a waste of time when they have perfectly good ones anyway.
But I have graphical buttons and after responding to users requirements of not having boring buttons I now have new complaints about scrollbars looking old fashioned.
Anyway, I can control the scroll but I have no way of knowing when the user has caused the scroll with cursor movement instead of clicking in my scrollbar.
I don't want to replace even more perfectly good functionality. Instead, I just want to catch that scrolling action when it happens.
I think I know roughly what the code will look like to do this. I have an example of replacing the word wrap in a textbox. I haven't tried running it yet but don't think it will work because I can see a typo in it. THe author tidied up his code instead of just giving the original and he forgot to rename a variable. I don't know which variable he forgot to rename.
Even knowing the syntax does not help me find an example on the net. I think I just need the semantics and I can figure the rest out. I can't understand how come I can't get this from a search but really I have tried very hard and I tend be good at searching for stuff like this.
I assume I capture and replace the scroll action. So looking up some pre-defined constants is what I need to do.
Please please someone give me an example or tell me how I look this up. The help for this doesn't seem to be anywhere.
I admit this shows my ignorance but I am sort of new to VB and never really learnt Windows programming properly. If anyone knows an alternative to Microsoft's offering for Assembler in Windows please tell me. I will pay quite a bit for it.
John Morley
How can you delete all ","'s from a text box
example i have a text which i save using the "Write" function but then when i reload it, it comes up wit the "" which i dont want to come up. How do i make it when i click a button it deletes all "" from the textbox?
Private Sub optSelect_Click()
' place the insertion point at the beginning
txtDisplay.SelStart = 0
' find the length of the string and
' select that number of characters
txtDisplay.SelLength = Len(txtDisplay.Text)
' set the focus to the text box so we can see
' the result of our settings
txtDisplay.SetFocus
End Sub
Hope it helps.
I found this code in the controls.vbp located in the MSDN Samples VB 98 folder
Is there a way of selecting all the text in a text box when it gets the focus in VB6?
I'm in the middle of writing an application and would like the users to be able to type straight over the prompt when they tab in to the box or click on it.
Was hoping for something along the lines of...
private sub text1_gotfocus()
text1.selectall
end sub
but can't seem to find anything simple that'll work.
Or should I be using a rich text box rather than a normal one?
Thanks!
Oooops, the following is C# code...
Try this:
textBox1.SelectionLength = 0;
textBox1.ScrollToCaret();
This can be added directly after the Text update, ie:
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.SelectionLength = 0;
textBox1.ScrollToCaret();
If there is alot of lines being pasted then the textBox will flicker.
I am creating a chat client and have go the chat room information to appear in a multilined textbox. It works great but all the text is the same color, is there a way to make every other line a different color? Also is there a way to make the text that I have sent be a different color then the rest?
Thanks for the help
Mike
This piece of code makes the scrollbar move down to the bottom.
Unfortunately, in my programs, it does so even when you're trying to scroll up and look at previous conversation.
If anyone can help me with that, I'd be grateful.
Text1.SelStart = Len(Text1.Text)
Hello!
My question is the following...
I am building a CHAT Program in VB, to write the text in the chat I use a 'SingleLine' Textbox and above it I have the BIG MultiLine TextBox with a vertical scrollbar.
The MultiLine TextBox shows my messages and the other users' messages but I have a problem, when new text is added to the TextBox, this Control REFRESHES and sets the SCROLLBAR to it's <TOP>, but what I need is to do exactly the OPPOSITE.... to go to the BOTTOM !! because the NEW TEXT added is in the BOTTOM.
I think that I have to put something in the CHANGE Event of the TextBox to automatically go to BOTTOM (the scrollbar) in order to SHOW the last added TEXT.
IF YOU KNOW SOMETHING TO SOLVE THIS, PLEASE HELP ME!
Thanks!!!!!!!!!!
Sebastián from ARGENTINA.
Text1.Text = ""
End Sub
Is there a piece of coding that can be used with a button to clear the contents of text boxes?
This thread is for discussions of TextBox Control.