I have a text box control and I want to select a multiple ranges of text when i click on button.
for example:
the text is :"I want to select"
and I want that the selected words will be "want" and "select".
do you have an idea of how to implement this?
thanks,pavel.
Not sure if this is what you're looking for but:
var words = textBox1.Trim().Split(' ');
Then you have an array of strings of all words. . Trim() ensures that you don't have any spaces in front or after the 'sentence'.
Related
While having multiple carets, is it possible to search for a character, and each caret will jump to the location of that character relative to the caret position?
For example, in the screenshot below, how to do jump to the next comma (',') for each of the carets?
One awkward method which sometimes can do the job is:
Change to column selection
Select the area where all relevant search results appear
Apply "Replace..."
Ensure "In Selection" is checked
Type the search string
Click "Select All Occurrences"
Would be much nicer if Incremental Search would work with multi-carets.
So, I have a custom function that concatenate different cells and put a comma between words.
For example, say I have "ABCD" "BC" then, this function will
output ABCD, BC. Now the problem is that the text will overflow in a cell and overlap with the cell next to that. In order to solve this problem,
I am thinking of just replacing the concatenated word with "Multiple" if more than 3 words are combined. Is there anyway to do this in a cell?
You can do this with conditional formatting AND keep the original underlying string as a raw value for other purposes.
Select the cells with the formula and create a conditional formatting rule based on a formula. =LEN(C2)-LEN(SUBSTITUTE(C2, ",", ""))>1
Click Format and go to the Numbers tab. Choose Custom from the list down the left side and supply the following for the Type: ;;;[color13]_((\multipl\e) I've opted to also make the font dark blue (colorindex # 13) and indent from the left.
Click OK to accept the formatting and then OK again to create the new rule.
As you can see in the sample image above, the underlying raw value remains (shown in the formula bar) but (multiple) is displayed.
More on custom number formatting codes at Number format codes
As the title says, I would like to display an underline character _ in a dynpro field text. Is it possible? I have tried every possible option in the field text attributes.
PS: I know P_BUKRS is not the best name, it's just to show the issue.
Instead of text fields use an input field and set it to output only. Then you can set the text during PBO which will show underscores.
DATA: lbl_bukrs(7).
MODULE init.
lbl_bukrs = 'P_BUKRS'.
ENDMODULE.
Here is a quotation from SAP Help.
If the text consists of several words, they are joined together automatically by underscores, which are replaced by spaces at runtime.
Based on that the answer would be no, it is not possible for a text field to display underscores because they will be replaced by spaces at runtime anyway.
i would like to force the textbox to immediately change the text to UCASE as soon as the user moves away from the field. is this possible?
the important thing is that this text will be used in a SQL query to update a table.
In the after update event of the text box on the form, simply go:
If isnull(me.MyTextBox) = false then
Me.MyTextBox = ucase(Me.MyTextbos)
End if
You can also specify a input mask on the form.
">LLLLLLLLL"
The above ">" will force all chars as you type to upper case. The number of L is a any char mask. (and, you don't need the " around the input mask)
Solution from Albert don't work for me.
I use this method: put form in "design view", select the control, in the property sheet, in the format tab, in the format property insert the value ">" w/o quotes.
I'm putting together a template in Word, using a form for the user to fill in to then populate some of the document.
The bit I'm currently stuck on is at the end of the document, where the cc's are listed.
The form has a multiline text box into which the user puts in their cc's, one per line.
I then want to add to the end of the document the contents of the text box, but in the right format. Specifically, it should look like:
cc: First CC contact
Second CC contact
so on and so forth
I attempted to do this using 2 bookmarks, so my code currently is:
' If 'CC' box has content, add it
If doc_CC.TextLength > 0 Then
.Bookmarks("CC").Range.Text = vbCr + "cc:"
.Bookmarks("CCs").Range.Paragraphs.Indent
.Bookmarks("CCs").Range.Text = doc_CC + vbCr
End If
However, when this is run, on the page it looks like:
cc: first contact
second contact
and so on
Realise that the 2 bookmark method is a bit messy but it seemed like a good idea at the time - obviously this is not the case! Have done some searching for a way to do it with Split but am not making much progress down this path - suspect I'm googling for the wrong thing.
How do I do this so that the formatting is as desired? Any help is greatly appreciated.
Try inserting a tab character? + Chr(9) or even + vbTab may work.
Have found a work around which, while doesn't answer the actual question of how to do it, does produce a result to the same effect.
Have used a 2 column table without no lines instead with contents of a1 being "cc:" and contents of a2 being whatever was entered into the multiline text box. If there is nothing in the text box, then the table is deleted.
I'll keep on eye on this question though so if some one does have the proper answer I can mark it accordingly.
Another possibility would be to format the cc paragraph with a hanging indent (like is used for bullets or numbering). Use a newline character - Chr(11) - instead of vbcr to separate each entry. The text should all line up,then...