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
Related
I have a pretty simple form that brings up a certain record when the "caseNumber" is selected from the combobox. Although after a selection is made within the combobox, it will freeze the entire form on the record selected. I can't click on any other text boxes or buttons. I have to stop the debugger. No errors are thrown. I've read where this has happened to others, but no answers to the problem, that I can find.
There is no code behind it so far, as the form is bound to a dataset and should just bring up the rest of the information once the caseNumber is selected.
Changed the "Selected Value" dropbox to "none" on the data binding menu for the combobox.
Under DataBindings, go to Advanced and make sure DataSource update mode is on NOne
A lot of times this happens because there is a problem in the binding. Are you sure it's not binding the text value of the control(the combobobox) to the data?
The correct way to bind (under DataBindings, Advanced) was to bind it to the SelectedValue instead of Text.
Please let us know a little bit more how your combobox is binded.
I have a dynamic list of values that I want the user to select from, how is it possible to do it with VSTO ? Would it be possible to prompt a listbox (as a MessageBox ?) and retrieve the selected item ? Or could I add a listbox in the Ribbon ?
Thank you for your help
Have you tried to add DropDown/ComboBox control to ribbon bar?
Alternatively, perhaps you could create a custom windows form and place the control on it. Then attach that form to an event, add-in start, button click, etc.
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.
I want set Listbox background to transparent but not working
Is there any idea?
As you've no doubt encountered it appears that you can't do this with a ListBox. One possible alternative (suggested here) is to use a list of Labels (which can be transparent) in place of a ListBox. It might not be practical for your situation but it's an option.
The exemple with label is a good idea if you don't want to use WPF. But, if you want to sort, the list a purpose to you to create a list with all the label name and create the number of label you need in a flowpanel. When you want to sort, you not sort the label, but the list, and after change the name of the label.
Ju
Best way is to use Windows presentation foundation ! (WPF)
My winforms application will display 100 different names, and I will need the user to enter a number 1 through 4 next to each name. I will then store this data.
I know I can use the spreadsheet control, but is there something much simpler that I can use?
Maybe an array of textboxes or a datagrid?
You should be able to use a datagrid and have the first column contain a textbox Item and have a second column display a name. you should also be able to use a listview the same way. Although to be honest you might want a drop down box put in the gridview instead of a text box because with a dropdown/combo box you can make sure they input only a 1-4 because that will be there only options
I would recommend using a DataGrid. This will scale much better than an array of TextBoxes, and should do exactly what you need.
Why not use a numeric up/down control (spinner)?
Something like this would work well:
http://visualbasic.about.com/od/usingvbnet/l/aa082103a.htm
You can embed this in a custom field in a datagrid or repeater if necessary.
You can also just use a combobox:
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx
Depending on what you are using this for, you might also be able to use something like this:
http://www.codeproject.com/KB/miscctrl/cs_star_rating_control.aspx
Then the user can just click the value.
With either of these options at least your user wont have to enter a value manually and you can set bounds in the control instead of having to validate their input. Your last option should be the user entering a number into a textbox really.