vb.net如何轉(zhuǎn)c# vb轉(zhuǎn)換進(jìn)制

如何把下面用vb.net語(yǔ)言編寫的代碼改成c#

給你個(gè)網(wǎng)站看

在鯉城等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需定制設(shè)計(jì),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站制作,網(wǎng)絡(luò)營(yíng)銷推廣,成都外貿(mào)網(wǎng)站建設(shè)公司,鯉城網(wǎng)站建設(shè)費(fèi)用合理。

可在線將vb.net代碼轉(zhuǎn)成c#的,我用過(guò),還可以的,但是轉(zhuǎn)后也要改動(dòng)一些。這里還有將c#轉(zhuǎn)vb.net的。

這是我轉(zhuǎn)的:

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;

//確定所要查詢的月的天數(shù)

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代碼換成C

可以試試VBto Converter

VBto Converter是一款VB語(yǔ)言轉(zhuǎn)換軟件,它支持將MS Visual Basic資源文件(包括源代碼)轉(zhuǎn)換成MS VC++ MFC, VC++.NET (CLR), VBNET, C#, J#, Borland C++ Builder, Borland Delphi源文件。

vb.net 轉(zhuǎn) c#

--VB--

Public Function ff() As Boolean

ff=true

End Function

--C#

public bool ff()

{

return true;

}

----

這里的 ff=true 是相當(dāng)于 C#里的 return true; 是給vb函數(shù)自身返回值用的.

--VB--

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

ff=true 'vb里可以省略函數(shù)的小括號(hào)()

End Sub

--C#--

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

{

ff() == true;

}

這里的 ff=true 是相當(dāng)于 C#里的 ff() == true; 是判斷.

在vs2008中怎樣將vb的項(xiàng)目轉(zhuǎn)換成c#的項(xiàng)目?

這需要三個(gè)步驟:

第一步:創(chuàng)建一個(gè)C#項(xiàng)目,在其中添加相應(yīng)的窗體和引用,將VB2008中相應(yīng)窗體上的控件復(fù)制到C#相應(yīng)的窗體上;

第二步:使用C#與VB.NET轉(zhuǎn)換工具軟件或者到“”,將VB2008 的代碼轉(zhuǎn)換成C#代碼。

第三步:工具軟件或者在線轉(zhuǎn)換,轉(zhuǎn)換后的代碼會(huì)有一些錯(cuò)誤或者無(wú)法轉(zhuǎn)換的部分,進(jìn)行簡(jiǎn)單的人工修正。

OK,你成功了!

網(wǎng)站標(biāo)題:vb.net如何轉(zhuǎn)c# vb轉(zhuǎn)換進(jìn)制
本文地址:http://muchs.cn/article46/hhspeg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站排名、搜索引擎優(yōu)化網(wǎng)站收錄、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

猜你還喜歡下面的內(nèi)容