vb.net DataGridViewComboBoxColumn和下拉样式 [英] vb.net DataGridViewComboBoxColumn and dropdown style

查看:490
本文介绍了vb.net DataGridViewComboBoxColumn和下拉样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数据网格中,我使用的是其中包含项的组合框,因此用户可以开始键入新值或选择comobo框中存在其他项的项.

问题是当您开始键入并自动使用已经存在的项目填充它时,您按Enter键或向右箭头转到下一个字段,comobobox中的项目将变为空白.

当您回到该领域并再次执行该操作时,它将起作用!我到处搜索,找不到解决方案,有人可以帮忙,我真的很感激.

谢谢

Within a datagrid, I''m using a combo box which has items within it so a user can start typing a new value or select an item that alrerady exists within the comobo box.

The problem is when you start typing and automatically it populates with an item that alread exists and you hit the enter key or right arrow to go to the next field the item within the comobobox goes blank.

When you go back into that field and do it again - it works! I''ve searched everywhere and can''t find a solution to this, can anybody please help, I would really appreciate it.

Thanks

推荐答案

,您可能需要其他列类型,请参见:灵活的ComboBox和EditingControl 可能对此有用
you may need other column type please see: Flexible ComboBox and EditingControl it may be useful for this


<pre lang="vb">Private Sub dgDetails_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgDetails.CellLeave
       If Not cb Is Nothing Then
           cb.SelectedIndex = cb.FindStringExact(cb.Text)
       End If
   End Sub



这篇关于vb.net DataGridViewComboBoxColumn和下拉样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆