如何将代码从C#转换为VB.NET [英] how to convert code from C# to VB.NET

查看:78
本文介绍了如何将代码从C#转换为VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将C#代码版本2.0(2005)转换为vb.net 1.0(2000)
我尝试了以下网站进行转换,但该网站从2005年转换为2005年

1
2
为此发布解决方案

或者说在VS 2000 gridview中没有针对此的解决方案,因此我在其中使用了datagrid控件.在该数据网格控件中,行"属性不可用.

how to convert c# code version 2.0(2005) to vb.net 1.0(2000)
i have tried the following sites to convert but that r convert from 2005 to 2005

1
2
post solution for this

or otherwise say solution for this in VS 2000 gridview is not available, so i used datagrid control in that. In that datagrid control Rows property is not available.

protected void btnadddata_Click(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=TNVKP_8;Integrated Security=True");
    for (int i = 0; i < GridView2.Rows.Count; i++)
    {
        //GridViewRow row = GridView1.Rows[i];
        //CheckBox chkbox = (CheckBox)row.FindControl("chkbox1");
        CheckBox chkbox = (CheckBox)GridView2.Rows[i].FindControl("chkbox1");
        Label label1 = (Label)GridView2.Rows[i].FindControl("Label1");
        Label label2 = (Label)GridView2.Rows[i].FindControl("Label2");
        Label label3 = (Label)GridView2.Rows[i].FindControl("Label3");
        Label label4 = (Label)GridView2.Rows[i].FindControl("Label4");
        Label label5 = (Label)GridView2.Rows[i].FindControl("Label5");
        Label label6 = (Label)GridView2.Rows[i].FindControl("Label6");
        Label label7 = (Label)GridView2.Rows[i].FindControl("Label7");
        Label label8 = (Label)GridView2.Rows[i].FindControl("Label8");
        Label label9 = (Label)GridView2.Rows[i].FindControl("Label9");
        Label label10 = (Label)GridView2.Rows[i].FindControl("Label10");
        if (chkbox.Checked == true) //&& (row.Cells[11].Text=="Ok")
        {
            con.Open();
            string str;
            str = "insert into employee (empid,empname,empaddress,empcity,empstate,empzip,emplic,empstatus,empp,empi) values('" + label1.Text + "','" + label2.Text + "','" + label3.Text + "','" + label4.Text + "','" + label5.Text + "','" + label6.Text + "','" + label7.Text + "','" + label8.Text + "','" + label9.Text + "','" + label10.Text + "')";
            SqlCommand com = new SqlCommand(str, con);
            com.ExecuteNonQuery();
            con.Close();
        }
        Label1.Text = "Records inserted";
    }
}

推荐答案

如果您想向后退,最好的选择是继续进行正常转换,然后手动更改代码与相应的.Net早期版本兼容.
If you''re trying to go BACKWARDS, your best bet is to go ahead and convert it as normal, and then manually change the code to be compatible with the appropriate older version of .Net.


www.developerfusion.com/tools/Convert/csharp-to-vb/

使用此链接转换您的代码
www.developerfusion.com/tools/Convert/csharp-to-vb/

use this link to convert ur code


以下是在线代码转换站点的链接-

http://converter.telerik.com/ [ ^ ]

www.carlosag.net/tools/codetranslator/ [ www.developerfusion.com/tools/Convert/csharp-to-vb/ [ ^ ]
Following are the links to online code conversion sites-

http://converter.telerik.com/[^]

www.carlosag.net/tools/codetranslator/[^]

www.developerfusion.com/tools/Convert/csharp-to-vb/[^]


这篇关于如何将代码从C#转换为VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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