中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

vb.net代碼轉(zhuǎn)成c c#轉(zhuǎn)vb

怎樣將VB代碼換成C

可以試試VBto Converter

成都創(chuàng)新互聯(lián)公司專注于蘇家屯網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供蘇家屯營銷型網(wǎng)站建設(shè),蘇家屯網(wǎng)站制作、蘇家屯網(wǎng)頁設(shè)計(jì)、蘇家屯網(wǎng)站官網(wǎng)定制、微信平臺(tái)小程序開發(fā)服務(wù),打造蘇家屯網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供蘇家屯網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。

VBto Converter是一款VB語言轉(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; 是判斷.

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

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

可在線將vb.net代碼轉(zhuǎn)成c#的,我用過,還可以的,但是轉(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.net代碼翻譯成c#代碼!

public string GetAllData(bool Verbose = true)

{

ListViewItem lvi = default(ListViewItem);

try {

ports.Serial.settings.SetStandard(MyPort, 9600, 0);

ports.Serial.settings.useDTR = 1;

ports.Serial.settings.useRTS = 1;

if ((ports.Serial.Open() == false)) {

return "Failed To Open Port";

}

if (Verbose) {

lvi = status.setMessage("WeatherDuck", "Data Sample", "Begin", true);

lvi.ForeColor = System.Drawing.Color.Blue;

}

System.Threading.Thread.Sleep(por_delay);

ports.Serial.FlushRcv();

ports.Serial.SendString("T");

System.Threading.Thread.Sleep(read_delay);

string Temperature = ports.Serial.ReadString();

if ((Temperature.Length == 0))

return "Failed To Read Temperature";

char[] split = ",".ToCharArray();

string[] temp = Temperature.Split(split, 2);

_tempC = temp[0];

_tempF = temp[1];

if (Verbose)

lvi.SubItems(2).Text = "Done Temperature";

ports.Serial.SendString("H");

System.Threading.Thread.Sleep(read_delay);

_humidity = ports.Serial.ReadString();

if ((_humidity.Length == 0))

return "Failed To Read Humidity";

if (Verbose)

lvi.SubItems(2).Text = "Done Humidity";

ports.Serial.SendString("L");

System.Threading.Thread.Sleep(read_delay);

_lightlevel = ports.Serial.ReadString();

if ((_lightlevel.Length == 0))

return "Failed To Read LightLevel";

if (Verbose)

lvi.SubItems(2).Text = "Done Light Level";

ports.Serial.SendString("F");

System.Threading.Thread.Sleep(read_delay);

_airflow = ports.Serial.ReadString();

if ((_airflow.Length == 0))

return "Failed To Read Air Flow";

if (Verbose)

lvi.SubItems(2).Text = "Done Air Flow";

int i = 0;

while ((true)) {

i = i + 1;

if ((i = sound_delay))

break; // TODO: might not be correct. Was : Exit While

System.Threading.Thread.Sleep(500);

if (Verbose)

lvi.SubItems(2).Text = "Sampling Sound Level: " + i.ToString();

}

ports.Serial.SendString("S");

System.Threading.Thread.Sleep(read_delay);

_soundlevel = ports.Serial.ReadString();

ports.Serial.SendString("S");

System.Threading.Thread.Sleep(read_delay);

_soundlevel = ports.Serial.ReadString();

if ((_soundlevel.Length == 0))

return "Failed To Read Sound Level";

return "Success";

} catch (Exception bug) {

if (Verbose)

status.setMessage("WeatherDuck", bug.Message, "Error", false);

return "Exception During Get Data: " + bug.Message;

} finally {

ports.Serial.Close();

if (Verbose) {

lvi = status.setMessage("WeatherDuck", "Data Sample", "Done", true);

lvi.ForeColor = System.Drawing.Color.Blue;

lvi = status.setMessage("WeatherDuck", "Port Status", "Closed", true);

lvi.ForeColor = System.Drawing.Color.Blue;

}

}

}

VB.NET object 轉(zhuǎn)換到C#object問題

你實(shí)例化對(duì)象看看哈

VB 和C# 的object 在變異的時(shí)候是不一樣的,你不做修改正常出錯(cuò)

object指對(duì)象,代表的是通用的對(duì)象,就是什么對(duì)象都可以表示,new只能表示固定的對(duì)象

還有注意一下大小寫object和Object是不一樣的

在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ò)誤或者無法轉(zhuǎn)換的部分,進(jìn)行簡單的人工修正。

OK,你成功了!

分享標(biāo)題:vb.net代碼轉(zhuǎn)成c c#轉(zhuǎn)vb
網(wǎng)站地址:http://m.rwnh.cn/article42/hpjehc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、網(wǎng)站排名、云服務(wù)器、自適應(yīng)網(wǎng)站、企業(yè)網(wǎng)站制作App開發(fā)

廣告

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

商城網(wǎng)站建設(shè)
乌海市| 沾化县| 岑溪市| 罗源县| 大同县| 平顶山市| 大荔县| 出国| 汤原县| 竹山县| 广德县| 京山县| 开鲁县| 临高县| 吕梁市| 高清| 拜泉县| 资中县| 姚安县| 新巴尔虎左旗| 绵竹市| 西城区| 慈溪市| 香格里拉县| 富阳市| 辽阳县| 闽清县| 南部县| 郴州市| 兴文县| 红原县| 尚义县| 虎林市| 日照市| 镇坪县| 汾阳市| 河池市| 罗源县| 郁南县| 明水县| 会泽县|