首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

VB.NET 转 C#NET解决办法

2012-09-17 
VB.NET 转 C#.NETVB codePrivate Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.Eve

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

热点排行