vb.net转换为c vbnet goto

在vs2008中怎样将vb的项目转换成c#的项目?

这需要三个步骤:

公司主营业务:成都网站制作、网站设计、外贸网站建设、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。成都创新互联公司是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。成都创新互联公司推出龙里免费做网站回馈大家。

第一步:创建一个C#项目,在其中添加相应的窗体和引用,将VB2008中相应窗体上的控件复制到C#相应的窗体上;

第二步:使用C#与VB.NET转换工具软件或者到“”,将VB2008 的代码转换成C#代码。

第三步:工具软件或者在线转换,转换后的代码会有一些错误或者无法转换的部分,进行简单的人工修正。

OK,你成功了!

如何把下面用vb.net语言编写的代码改成c#

给你个网站看

可在线将vb.net代码转成c#的,我用过,还可以的,但是转后也要改动一些。这里还有将c#转vb.net的。

这是我转的:

string[] ArrValue = new string[43];

int Nums;

public void Page_Load(object Sender, EventArgs E)

{

int I;

if (!IsPostBack) {

for (I = 1900; I = 2101; I++) {

ListItem IItem = new ListItem();

IItem.Text = (string)I;

if (I == Year(Now)) {

IItem.Selected = "True";

}

DropYear.items.add(IItem);

}

for (I = 1; I = 12; I++) {

ListItem IItem = new ListItem();

IItem.Text = (string)I;

if (I == Month(Now)) {

IItem.Selected = "True";

}

DropMonth.items.add(IItem);

}

}

DispDetail(Conversion.Val(DropYear.SelectedItem.Text), Conversion.Val(DropMonth.SelectedItem.Text));

}

public void DispDetail(int YYear, int MMonth)

{

System.DateTime theDate;

int theYear;

int theMonth;

int theDay;

int theWeek;

int theFirstNum;

int NumOfMonth;

int i;

string theStr;

theYear = YYear;

theMonth = MMonth;

theDay = 1;

//获得所要查询的月的第一天日期

theDate = DateSerial(theYear, theMonth, theDay);

//确定所要查询的第一天是星期几

theWeek = weekday(theDate);

theFirstNum = theWeek;

//确定所要查询的月的天数

NumOfMonth = GetDayNum(theyear, themonth);

for (i = 0; i = 41; i++) {

ArrValue(i) = "";

}

for (i = 0; i = NumOfMonth - 1; i++) {

ArrValue(theFirstNum - 1 + i) = i + 1;

}

}

public object GetDayNum(int YYear, int MMonth)

{

object functionReturnValue = null;

if (MMonth == 1 | MMonth == 3 | MMonth == 5 | MMonth == 7 | MMonth == 8 | MMonth == 10 | MMonth == 12) {

functionReturnValue = 31;

}

else {

if (MMonth == 4 | MMonth == 6 | MMonth == 9 | MMonth == 11) {

functionReturnValue = 30;

}

else {

if (((YYear % 4 == 0) (YYear % 100 != 0)) | (YYear % 400 == 0)) {

functionReturnValue = 29;

}

else {

functionReturnValue = 28;

}

}

}

return functionReturnValue;

}

vb.net 转 c#

--VB--

Public Function ff() As Boolean

ff=true

End Function

--C#

public bool ff()

{

return true;

}

----

这里的 ff=true 是相当于 C#里的 return true; 是给vb函数自身返回值用的.

--VB--

Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ff=true 'vb里可以省略函数的小括号()

End Sub

--C#--

private void Form_Load(System.Object sender, System.EventArgs e)

{

ff() == true;

}

这里的 ff=true 是相当于 C#里的 ff() == true; 是判断.

网站栏目:vb.net转换为c vbnet goto
文章来源:https://www.cdcxhl.com/article38/dosdpsp.html

成都网站建设公司_创新互联,为您提供ChatGPT自适应网站静态网站域名注册微信小程序云服务器

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

h5响应式网站建设