vb.net How to make a DropDownList with readonly appearance - vb.net

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.

Related

Add "X" button at the end of a TextBox

My question is the opposite of this one (Remove "X" button at the end of a TextBox).
I have a vanilla TextBox (with TextWrapping set to NoWrap), but I'm not seeing the clear cross delete button.
This is a store/universal/winrt app, so it's a Windows.UI.Xaml.Controls.TextBox.
I haven't got any overrides for the default template in App.xaml either.
Any ideas?
If you can afford it, you can use Telerik UI for Windows Phone. It has a textbox control with a built in clear button.
Other route would be implementing your own user control. It should be rather easy.

How can you add an image to a listbox in VB?

I am wanting to add an image to the top or background of a listbox. I would like it to be visible on the screen, but more importantly is that it prints. Can someone help me with the code for this. I tried to see if you could add it through properties and don't see that option. I need the listbox not listview. Also I was wondering if it could be added as a string and the file referenced at the top of the listbox (when you right click the little arrow and click edit options? Can someone please help. I am working on a project and still very new at this.
You need to create a custom ListBox class and add the ability to draw a custom background by overriding the OnPaint event, like on:
Source: http://www.vbforums.com/showthread.php?416784-2005-ListBox-Background-Image

Checkbox with image and autosize

In Word 2012 I have seen the following checkbox:
I am wondering if this checkbox is a .NET control with an image assigned to it (with property "imagealign" being middle right) or if this is a custom solution by MS for their Office GUIs.
I can reproduce the appearance, but I am unable to easily check if the user clicks the checkbox (and wants to change its state) or the info button and wants to show the tooltip.
Also, I have to add some spaces at the end of the checkbox text, else the image is under the text if the checkbox autosize property is set to True.
I would tend to think that the checkbox is a custom solution by MS or perhaps the image is a separate control.
Does anybody know more about this?
I think you are looking for
Checkbox.AutoSize = False
CheckBox.Image = "Your Image"
CheckBox.ImageAlign = MiddleRight
But this way you won't be able to distinguish if the user clicks the checkbox or the info button to show the tooltip.
As far as I know, there is no control available at .NET which allows this behavior, so I suppose they are using separate controls.
I think you'll need to use a PictureBox near the CheckBox and then use CheckBox_CheckedChanged and PictureBox_Click events to do whatever you want on each case.

Metro App Create Email Address Entry Xaml Control

How do I create a Control to input email addresses, similar to how capturing tags on stackoverflow works?
I am using C# and Xaml.
You will need:
TextBox(to show input area where you can type)
Popup(to show suggestions below TextBox like StackOveflow does)
ItemsControl(it goes into Popup, so you can just have collection of items and they will be displayed, note that ItemsPanel should be probably GridView)
Then you will need custom Button, that will be overlaid top of TextBox once tag has been added. You need to calculate how big is the button(width) and fill TextBox with empty spaces, to advance cursor further.
Also you need to control what keys are being pressed.
The effect you are after is probably that you recognize complete e-mail addresses, and render them in a custom way. I would do this by removing the completed addresses from the textbox, and wrap them in a skinned label (or maybe a custom control with a delete button).
The most straightforward way is to implement the textbox as a DockPanel with a border, suggesting that it is a text box. On the left side of your DockPanel, you have a StackPanel where you stack the completed address controls left-to-right. Then add a textbox with DockStyle=Fill to fill up the remainder of the DockPanel. Once you detect an email address is entered, you remove the characters from the textbox and add a matching control to the StackPanel.
There is probably a way to change the textbox contents without losing focus, otherwise you need to fix this though code.
Good luck!

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