SelText Position In A Web Control
how i can find the SelText Start Postion and End Position in a Microsoft Web Control.i.e when i am in desgin mode whatever text i selected i want to display its Start x,y position and End x.y position in a contol.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Seltext Cursor Position
I am using the following code, whenever a user presses the "#" key, it will turn "#" color to red. Is there a way to position the cursor at the end of textbox. ie. so once the "#" is pressed typing will continue normally?
Any help would be appreciated,
Private Sub RichTextBox1_Change()
Dim Search, Where
Search = "#"
Where = InStr(RichTextBox1.Text, Search)
If Where Then '
RichTextBox1.SelStart = Where - 1 ' set selection start and
RichTextBox1.SelLength = Len(Search) ' set selection length.
RichTextBox1.SelColor = vbRed
RichTextBox1.SelStart = Where + 1
RichTextBox1.SelColor = vbBlack
Highlight Seltext And Get The Seltext To Form1.text1.text
how can i get seltext copied from another textbox or webpage text (like this text) when u double click this text it will highlight right? then how to copy the highlighted seltext to form1.text1.text? can u guys provide me some source code example..i took a long days to search this code using mr. google..
Seltext And Get Focus Textbox -- See Seltext When Not Focused :S
I really have no clue if that is possible in vb since im a total newb,
I also have no clue if it has already been awnsered but I can't find it on the forum so I guess not.
I have 2 form, a form with a text editor similar to notepad
and another one obtained by clicking the search button
-- frmediteur(text form) and frmremplacer (find form) here is the code of the button.
Private Sub cmdsuivant_Click()
Dim intposition As Integer
Static intdebut As Integer
'If Not trouver Then frmediteur.txtediteur.SetFocus
strrecherche = txtrecherche.Text
On Error GoTo erreur
If Not trouver Then
intposition = InStr(1, frmediteur.txtediteur.Text, strrecherche, 1)
If intposition = 0 Then
MsgBox strrecherche + " est introuvable", vbExclamation, "Recherche terminé"
frmediteur.txtediteur.SelStart = intposition - 1
frmediteur.txtediteur.SelLength = Len(strrecherche)
'MsgBox "J'ai trouvé le mot " + strrecherche + " a la position " + Str(intposition)
cmdsuivant.Caption = "Suivant"
trouver = True
intdebut = frmediteur.txtediteur.SelStart + 2
End If 'TEST
intposition = InStr(intdebut, frmediteur.txtediteur.Text, strrecherche, 1)
If intposition = 0 Then
MsgBox "Recherche Terminé", vbInformation, "Fin"
trouver = False
cmdsuivant.Caption = "Chercher"
frmediteur.txtediteur.SelStart = intposition - 1
frmediteur.txtediteur.SelLength = Len(strrecherche)
intdebut = frmediteur.txtediteur.SelStart + 2
erreur: Exit Sub
everything works fine and im happy I pass alot of time on this rofl
but! the selected text doesn't appear unless I click on frmediteur - form - if I stay on frmremplacer - form - I can't see what is selected...
I can include screenshot, but im sure someone see what I mean.
I was wondering what is the solution for that kind of problem,
I heard about activex but I don't find anything related to my topic anywhere (maybe I don't know how to search :P)
thanks in advance.
ps: Just to specify, that button do a find on the first click and a find next on the second and other click until the end is reached.
Edited by - teezee on 2/9/2005 12:37:51 PM
OK I think this is right but I'll check, does the SelText function just change a selected part in a string for example, if you had
"Hello welcome to the vb forum" and set SelText has
text1.selText = "vb"
vb would be the only part of the text (string) changed?
When textbox is focused i want to select all text .
The combo boxes are filled. with the months---Jan,Feb,so on But, How do I select and save one of the Months in a cboBox to display in the datagrid and MSAsscess
SelText I Think?
In my current project I have a need to pass items into a text box and then to have those items change their format from normal to bold and the colour red. So if you can imagine, you click on an item in a list box and it then appears in the text box at the insertion point. I have the items appearing in the text box without any problem but the formatting is proving more tricky although I am sure the answer is simple.
I attempted to tackle the problem by taking the length of the text box len(textbox.text) and then subtracting the the length of the item inserted to use as a start point, then using seltext I attempt to select the item and then format it but it doesnt seem to be working, I suspect my syntax is incorrect? Can anybody help?
If I have a string, for example, "UserName: How are you today?". How do I extract everything before the ":" in "UserName:" to get the result string "UserName"?
Moses420ca@yahoo.ca?SUBJECT=I Love Your Stuff
i want the text in a textbox to be selected once the lostfocuss()
event is fired.
the foll code doent seem to work.
Private Sub Text1_LostFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SelText = Text1.Text
also i dont understand the difference between SelText & SelLen?
I want to move controls on form with API.
I get the position on the control with GetWindowRect hwnd, cRect. (it received the control position related to the screen).
I add to the Top/Left some pixels, And then I set the new position with SetWindowPos.
This is my code:
public Function ChangeControlsTop(byval cHwnd as Long, byval TopStep as Long) as Long
Dim ControlRect as RECT
GetWindowRect cHwnd, ControlRect
ControlRect.Top = ControlRect.Top + TopStep
SetWindowPos cHwnd, 0, ControlRect.Left, ControlRect.Top, 100, 100, SWP_NOSIZE
The problem is that the SetWindowPos change the control position related to his parent, and it possible that this control is in other control(like picturebox) etc.
Is any body know how can I fit between the two position ???
Thanks for help
Seltext With Right Button
Is it Possible to highlight text (seltext) using the right button??
I'm trying to use
private sub rtfRX_mousedown (Button As Integer, Shift As Integer, x As Single, Y As Single)
if button = 2 then
aMsg = rtfRX.seltext
the problem is aMsg is coming up empty..
Seltext Not Working
Can somone tell my why this is not working. I'm using a text box as an input for something else on the form. All I want is the text that is inthe text box already to be highlighted when a button on the form is pushed...
aStr = Text22.Text
Text22.SelStart = 1
Text22.SelLength = Len(Text22.Text)
Text22.Text = ""
Text22.SelText = aStr
I have even tried this with a RTB but can't get it to work...
Basically, i have a combobox which changes my textbox forecolor to the selected item. As shown:
Private Sub cboFontColor_Click()On Error Resume NextSelect Case cboFontColor.Text Case "Black" txtMain.ForeColor = vbBlack txtMain.SetFocus Case "Blue" txtMain.ForeColor = vbBlue txtMain.SetFocus Case "Green" txtMain.ForeColor = vbGreen txtMain.SetFocus Case "Red" txtMain.ForeColor = vbRed txtMain.SetFocus Case "White" txtMain.ForeColor = vbWhite txtMain.SetFocus Case "Yellow" txtMain.ForeColor = vbYellow txtMain.SetFocusEnd SelectEnd Sub
Only problem is, is that changes the WHOLE text to the specified color. I only need the selected text changing. I tried something like:
txtMain.SelText txtMain.ForeColor = vbYellow
But that errors(i took the On Error Resume Next handle out), Invalid Use of Property. What is wrong,
Thanks for any help
how do you make it so when you click a botton it move to a box you want to type in?, ive totally forgot
Question About Using SelText
How would I use the SelText (or SelStart?) property of a Rich Textbox control to display only text the user inputs in bold type?
Rtb Seltext Font
How can I change the Font of a selected text, I wanted to use the commondialog1.showfont but it do not work, any idea ?
Ole Container And Seltext
Is it possible to reference the text selected in an ole container?
(Ex. I have a form with OLE1. In the container is a word doc with the first sentence selected.)
How can I reference form1.ole1.seltext?
Help! Seltext In A Textbox
could anyone help me with the following , its driving me crazy!!.....
i am reading lines of text from a saved file using the LINE INPUT# statement. i need to put each line in the same textbox. In order to do this i need to add chr$(13) + chr$(10) so each line is separate. The problem i have is when i want to know the selstart of the selected text it adds 2 characters (the return and linefeed) to my seltext.
Is there a way of using the selstart without including these?
This may seen like an odd request but is there a longhand way of replacing
seltext in this piece of code?
For i = 1 To Len(Answer)
'Loop Through Each Letter In Answer
IsIn = False
For j = 0 To 25
'Loop Through Each Letter In Alphabet
If Not cmdLetters(j).Enabled Then
If Mid(Answer, i, 1) = Chr(j + 65) Then
IsIn = True
txtAnswer.SelText = Chr(j + 65)
If IsIn Then
If Mid(Answer, i, 1) = " " Then
txtAnswer.SelText = ""
txtAnswer.SelText = " * "
The SelText Subroutine???
I am trying to check what option is checked in a combo box. I was reading some documentation on SelText. It says...
Property SelText As String
Member of VB.ComboBox
Returns/sets the string containing the currently selected text.
So from what I understand no arguments are passed in and a string is returned. Here is my code below...
Private Sub calculateButton_Click()
Dim side As Variant
If (squareOption.Value = True) Then
If (cmbChoice.SelText = "Perimiter") Then
side = lengthText.Text
side = side * side
resultLabel.Caption = side
What I am trying to do is calculate the perimiter if the combo box has "perimiter" selected. But I get run time error 380, invalid property value. Am I reading the documentation on this subroutine incorrectly, or what???
Any help would be greatly appreciated....
Paste With Position Control
Ok, this is likely stupid but I can't find an answer and I figured a guru here would know if from the top of his or her head
I am pasting text to a dropdown box as the user types characters into it, updating the dropdown as he goes along (that is the easy part)
To do this, I .clear the list with every character change, which means I have to clear the text, which means I have to replace it.
The pointer, then, is as the front of the text string instead of the end. What I need to do is to paste with the pointer at the end of the text string, so that the user can just keep typing
Anyone know how?
Absolute Control Position
ok i want a function 2 find the absolute position of a control on the form.... for example if the control passed in is in 2 pic boxes it will return the twirps to the top left of the form
- i will be doing this kinda thing abit so i need a generic function -
Control Position On Screen
Any fast way to find a controls screen position other then getting the Left value of each parent all the way down to the form?
I want to replace the pixels in my picture box with the pixels of the DesktopDC but i gotta figure out the pixel position.
Absolute Control Position?
How can I know the absolute position of a control on a
form, using the upper left corner of the form as 1,1
These controls may be put inside other controls (nested)!
Would anybody help?
Control Startup Position
Hello all. I was wondering if anyone could tell me if it is possible to control the startup position of a seperate app? I am using VLC's media player to stream a terrestrial digital TV signal. The preferences with that app allow me to set the size etc but not the startup position. The code i use to launch the app from within my VB6 app is:
Code: Shell Chr(34) & "C:Program FilesVideoLANVLCvlc.exe" & Chr(34) & " -vvv udp://@126.96.36.199:5000 -- width 776 -- height -100", vbNormalNoFocus
If it is not posssible to directly control the startup position can anyone suggest some sort of work around. Thanks people
Shrek and Donkey and on another whirlwind adventure!
Getting .Text And .selText From WebBrowser
I'm using WebBrowser control, and need some properties it doesn't have.
- Get browser's text as string (like .Text in richtext box)
- Get selected text as string (like .selText in richtext box)
I guess i should use API, but don't know how...
The Best String Alternative To .seltext ?
Quite a basic question now.
Sure, with a textbox selecting text and then storing that in a variable is easy using the .seltext property but what is the best way to "select" text in a non-oject orientated string.
Would it be best to use Instr() to find the word position at which you want to start and end and then loop through every letter betwen these values adding it to a different string (the "selection" string) ??
SelStart = The Beggining Of SelText
I Have an RTB and i have selected text i.e.
I want the cursor to go back to the begging of the seltext and leave the text selected.
So in other words Select "DFGHJKIHLKJLKJ" and move the cursor back in front of the "D".
This seltext can be anywhere in the richtextbox so it is variable.
THanks for the HELP!
Tweaking Seltext In Richtextbox
Hi just a quick question which has been annoying me. I have a rich text box with groups of text in (3 lines per group)...
If i search a rich text box for a unique string, how can i also select the line above and below this found text? I can't just search for the whole chunk of three lines... i won't go into it all, but it's just not viable because information is duplicated in some areas... but one line of each group is unique (the text i am searching for) and i want to select the whole group relating to it.
I thought perhaps you can make the rich text box skip to the previous line, then select through another line and then the last line to select the whole group. Any way i can do this?
Question, Seltext And Savefile
hello , i have a working code that worked fine until we installed some service packs for windows 2000 pro . this is my issue ...
as400.SelText = sendq8.Text (this line of code suppose to copy the text to another text box...im sure everyone here knows that
the data looks like this ...
When i do ...
as400.SaveFile "c:LOGSas400q.log", rtfText
the file looks the same as above . but after the SP's were installed , the saved file now looks like this ...
TEST1 TEST2 TEST3 TEST4
The code hasnt changed since 2001 .. not sure whats causing the saved file to be formatted differently. If i open the file in WORDPAD its perfect but in NOTEPAD its wrong.
I feel like the answer to this issue is so simple but its not clicking.
Force A Control To Take Top Most Position On A Form.
I'm using a 3rd party control to view documents( VSPrinter).
I want to draw a line and have it sit on top of the VSPrinter control but the VSPrinter control always puts the line underneath it.
Any solutions to this problem?
Cursor Position In A TextBox Control
I was wondering if anyone knows how to determine the cursor position within a textbox control, or if not,suggest a work around for the following scenario:
I have an MSFlexGrid that I want to allow users to edit. Obviously, a bit of programming allows one to place a text box over the active cell in the grid. This is easy, and works without incident, but I want to add a bit more functionality by allowing the user to use the up/down left/right keys from within the textbox control to move around the grid. THe catch is that I only want the left/right keys to change the grid cell if the cursor is in the first column of the text, or the last column of the text respectively. Since there is no guarantee that any text will be HighLighted, I cannot use .SelStart.
Any thoughts would be helpful,
Move Control To Mouse Position
Can anyone show me how to move a control to the exact mouse position. I've been using the pointapi when I click on my form but the mouse won't move to the loaction of the cursor,
How To Set The Position Of DataPointLabel In MSChart Control
I have a problem try to move the position of DataPointLabel in Pie chart.
I am not sure but I try to use offset property to change its position, but it doesn't work. The label still the same position.
.LocationType = VtChLabelLocationTypeOutside
.LineStyle = VtChLabelLineStyleStraight
.Component = VtChLabelComponentPercent
.VtFont.Size = 10
.Offset.Set 10, 2
.PercentFormat = "0.00%"
The offset.set is not work because when I debug I check (X,Y) value it still (0,0) rather than (10,2)
How To Control Line Position In A TextBox
I am using a textbox with MultiLine set to true. When the number of lines exceeds the height of the textbox the vertical scrollbar becomes active. How can I tell the topindex or the line position of a textbox?
btw: I havent been using this forum for very long and was wondering how to mark a thread as resolved.
Position Form Based On Another Control
Hello, I am working on this game and need help with some form positioning. Since I have used the game so far on a Windows 2000 and XP I am seeing an issue. I have the main form and then another form opening up ontop of this form. The form that opens is positioned to cover a specific part of the main form. If I do the math on one computer, it looks different on the other because of the change of the borders and everything, the top/left get messed up.
I thought I would use a control on the form. Like setting a border around the area and then usign its top/left position but I can get that to work correctly. Can someone help me position 1 form based on a location of a control on another, so on any Operating System, they will line up correctly.
Window Size/position Control
i have shelled explorer like this
One = Shell("explorer.exe a:", vbNormalFocus)
Now i want to control its size and position, I will alse be shelling another window,
Two = Shell("explorer.exe C:Documents and SettingsJonMy DocumentsJon", vbNormalFocus)
and i want One to be on the left half of the screen and Two to be on the right half of the screen.
Position A Textbox On A Richtextbox Control
I have to design an interactive form where there are lots of explanatory texts and then some textbox controls that should naturally merge into the flow of text. For example a form would have the following:
Your name is <textbox> and address <textbox>.
I have tried using a RichTextbox control where the text contains a specific tag where I expect the textbox to be. I then get the character position of the tag using Find method. Once I get the position I use getLineFromChar to determine the line on which the tag appears. I then use the average height of a character to determine the pixel position of the tag and add this to the top property of the richtextbox. However, I can't find a way to determine the positon of the tag from the left of the richtextbox. This would enable me position my textbox at a particular position within the RTB during runtime.
Does anybody have any idea on how I can achieve this ? Or else, is there an altenative to using RTB ?
I cannot replace the textbox controls since the user should be able to edit the name and address.
Capturing Mouse X Position In A Control
I need a way to capture the X position of the mouse in a control.
I tried using the MouseMove Event but it doesn't seem to get the info i need.
I need to find out the X position as the user moves the mouse within the control.
Position Of Nodes In A Treeview Control
Is there any way to determine the position of a node in a group of child
nodes in a Treeview control? For example:
Days of Week
I would like to be able to programmatically determine that Monday is the
first child node, Tuesday the second and so on. Also, if I drag and drop
the child nodes, I need to be able to determine the node's new position.
For example (as the result of a drag and drop):
Days of Week
I now need to know that Wednesday is the first node, and so on.
Thanks for your help
Control The Position Of Components Depending On Others
I was wondering if it's possible to place components on a form
depending on the size of another component.
Let's say I have a datagrid that gets populated from a database.
Depending on the choices of the user, that qill create a query, and
depending on that query, the datagrid might have 10 rows or it might
only have 1. I want to place a radiobuttonlist as well as a label just
beneath the datagrid, but in the design view, I place it right under
the datagrid. And when the datagrid has many rows, my label gets mixed
in the datagrid. Or if it has only one row, the label is way underneath
it....at the bottom.
How can I control the position of components depending on others that
get populated at runtime ?????
I know one of u guys knows this......has to!!
thanks in advance!!
Text Position In Richtextbox Control
Hi Guys. I have spent the last few hours searching the internet trying to find out how to enter a string into the richtextbox control and have it display the string in the bottom left corner and stay in that position even if the form is maximised. Any subsiquent strings will scroll the control up.
Any ideas how to do this would be much appreciated.
Edited by - Gomjibar on 8/21/2004 7:05:43 AM
How To Get The Position Of Cursor In A Codemax Control
How to you get the cursor pos of the cursor in a codemax control.
I need it so I can use the command CodeMax.InsertText "Text", Pos as RECT
I know the position is a RECT, but Codemax does not have a command to retreave the curdor position, or I can't seem to finf it.
Any help would be great.