BindingSource.Find(多列) [英] BindingSource.Find (Multiple columns)

查看:236
本文介绍了BindingSource.Find(多列)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这很简单.但是对知识库的搜索却没有结果.这样吧.

I thought this would be simple. But a search on the knowledge base turned up nothing. So here goes.

我有一个绑定源,该源连接到一个表,其中字段决定唯一性.在刷新期间,我想返回到用户单击刷新按钮时所在的行.

I have a bindingsource that is connected to a table where tho fields determine uniqueness. Duringa refresh i would like to return to the row that the user was on when he clicked the refresh button.

BindingSource.find仅支持一栏,据我所知.那怎么办呢?

BindingSource.find only supports one column in so far as i have been able to infer. So how doi do it.

改变表是不可能的.除了搜索多个字段外,这是一个常见事件.例如,名字和姓氏,或者公司和日记帐号码.

Altering the table is out of the question. Besides searching on multiple fields is a common event. Like for example first and lastname or perhaps company and journal number.

感谢

Jerry C

推荐答案

我不完全理解您的问题,但这可以为您提供帮助.我解决此问题的方法是使用3-4个复选框控件,并在IF语句中实现它.例如:

I don't completely understand your question but this should help you out. The way I went about this problem is using 3 - 4 check box controls and implementing it in a the IF statement. For Example:

 

暗淡 strField As 字符串 = Textbox1.Text

Dim strField As String = Textbox1.Text

LNIndex 作为整数 = bindingsource.Find ( &; LastName"; ,strField)

Dim LNIndex As Integer = bindingsource.Find("LastName", strField)

FNIndex 作为整数 = bindingsource.Find ( &; FirstName"; ,strField)

Dim FNIndex As Integer = bindingsource.Find("FirstName", strField)

如果 cbFirstName.checked 然后

If cbFirstName.checked Then

其他 FNindex<> -1 然后

  Else FNindex <> -1 Then

BindingSource.Position = FNindex

    BindingSource.Position = FNindex

结束 如果

End If

如果 cbLastName.Checked 然后

   If cbLastName.Checked Then

其他 LNindex<> -1 然后

     Else LNindex <> -1 Then

BindingSource.Position = LNindex

        BindingSource.Position = LNindex

结束 如果

End If

 


这篇关于BindingSource.Find(多列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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