读书人

VB.NET 转 C#NET解决办法

发布时间: 2012-09-17 12:06:51 作者: rapoo

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 + ") ");        }    }
[解决办法]
转换工具

读书人网 >VB Dotnet

热点推荐