专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > VB Dotnet

VB.NET 转 C#NET解决办法

发布时间:2011-06-23 14:48:35 文章来源:www.iduyao.cn 采编人员:星星草
VB.NET 转 C#.NET
VB code

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        strWhere = "1=1"

        Dim i As Integer
        If Me.CheckedComboBoxEdit1.Text <> "" Then
            strWhere = strWhere & " and  名称 in (''"
            For i = 0 To Me.CheckedComboBoxEdit1.Properties.Items.Count - 1
                If Me.CheckedComboBoxEdit1.Properties.Items(i).CheckState = CheckState.Checked Then
                    strWhere = strWhere & ",'" & Me.CheckedComboBoxEdit1.Properties.Items(i).Value & "'"
                End If
            Next
            strWhere = strWhere & ") "
        End If



高手帮忙转换一下~

------解决方案--------------------
C# code
    private void btnOK_Click(object sender, System.EventArgs e) {
        strWhere = "1=1";
        int i;
        if ((this.CheckedComboBoxEdit1.Text != "")) {
            strWhere = (strWhere + " and 名称 in (''");
            i = 0;
            (this.CheckedComboBoxEdit1.Properties.Items.Count - 1);
            if ((this.CheckedComboBoxEdit1.Properties.Items(i).CheckState == CheckState.Checked)) {
                strWhere = (strWhere + (",\'" 
                            + (this.CheckedComboBoxEdit1.Properties.Items(i).Value + "\'")));
            }
            strWhere = (strWhere + ") ");
        }
    }

------解决方案--------------------
转换工具
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: