开发者

vb.net How to make a DropDownList with readonly appearance

开发者 https://www.devze.com 2023-03-26 14:47 出处:网络
I am developing desktop application开发者_如何学C using vb.net and vs2008. I have a DropDownList that I don\'t want it interact with use when the info is locked.

I am developing desktop application开发者_如何学C 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.

vb.net How to make a DropDownList with readonly appearance

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号