Getting highlighted text - vb.net

I have a text box. I need to get extract the highlighted and copy that to another text box.
User will highlight it after typing.
How to do it?
Thanks
Furqan

Use the SelectedText property (also available in XAML, if you’re using WPF instead of WinForms):
OtherTextBox.Text = FirstTextBox.SelectedText

Assuming you are talking about a System.Windows.Control, you can grab the SelectedText on the SelectionChanged event.

Related

Access and modify the Textbox's ContextMenu Items

I'm using vb.net 2013.
Is there any way to access and modify the TextBox's context menu items ?
I want to hide some of these items.
And I want to translate the caption.
Thank you !
Yes there is. Example below, where you hide based on a condition that you have set.
if (yourCondition) then
yourTextBox.ContextMenuStrip.Items.RemoveByKey(theNameOfTheStrip)
end if
I'm not sure what you mean by the caption (but i think it is the text)
yourTextBox.ContextMenuStrip.Items.Item(theIndexOrKeyHere).Text

vb.net How to make a DropDownList with readonly appearance

I am developing desktop application using vb.net and vs2008.
I have a DropDownList that I don't want it interact with use when the info is locked.
But if I disable it, it is greyed out and the text is not easy to read.
Is there any way to make radiobutton like readonly textbox?
I want text of the DropDownList looks black and itself is not clickable.
The above shows a disabled DropDownList with greyed out text and a readonly textbox
Try this:
Enable="false"
Place it within your <asp:DropDownList> tag.
I recently encountered a similar issue. My solution was to remove all other values of the DropDownList except the one that is selected. This will keep the text as black as opposed to grey. Users will be able see the existing value and click it but will not be able to change it.
Hope this helps.
No, you can't use CSS in a desktop app. When you disable the dropdownlist by setting Disabled=true; or Enabled=false (whatever the case is), you can also change the Font properties to make it easier to read. You can set other properties such as Border, BorderStyle, etc, etc.
Keep the control enabled. In the GOTFOCUS event, use SENDKEYS to send a {tab} to the form. the user will not be able to change it! By the way, workt for ALL controls, that a user can focus.

how to hide the dropdown icon of combobox

I have an application using ComboBox with ComboBox.DropDownStyle = DropDown, I want to hide the dropdown button of it, and dropdownitems will be displayed programmatically, when required.
How could I accomplish that?
Thanks in advance!
Renee147's was a good suggestion in that you seldom want to mix metaphors with UI elements.
But, if you REALLY needed to hide the dropdown arrow, I'd just stick a picture box on the form and size/move it to fit just over the arrow portion of the combo. Not technically sophisticated, but it'd work.
Try to use ComboBox.DropDownStyle = Simple

Visual Basic 2008: Textbox or label for displaying an answer?

What is the advantage of using a text box to display an answer in Visual Basic versus a label?
Using a (non-Disabled) textbox allows the user to select and copy the text.
You can automatically trigger a new event as soon as the textbox's text is changed using the textChanged function. this is not possible in case of a label.

Select all text in a Winforms Infragistics ComboBox

Is there a way to do this? I want to mimic the behavior of a the UltraTextBox.SelectAll method in windows forms.
You might want to provide the exact version of Infragistics Library...
Does
this.UltraCombo1.TextBox.SelectAll()
do what you want?
I think your problem is that you have HideSelection set to true. If you set this to false then textBox1.SelectAll will function as you expect...alternatively you need to give focus to your textbox before calling SelectAll().
I'm not sure how SelectAll works for UltraTextBox but I presume it just selects all the text in the textbox.