vb.net过度到c#容易吗????容易 。我以前就是弄vb和java的 。C#感觉比vb强大 。简直就是vb+java的综合体 。
怎样将VB代码换成C可以试试VBto Converter
VBto Converter是一款VB语言转换软件 , 它支持将MS Visual Basic资源文件(包括源代码)转换成MS VC++ MFC, VC++.NET (CLR), VBNET, C#, J#, Borland C++ Builder, Borland Delphi源文件 。
如何在vb.net调用c程序------------------------------------------00000000000000000000000000++++++++++++++++++
vb.net 调用C语言可执行程序并传值?在c语言中每一个变量都有两个属性一个是值 , 一个是址 。比如inta=2;变量a的值是2,变量a的地址,可以用取地址
操作符
获?。?即a 。因此以C语言的函数传递中具备两种方式传递参数,一种是传址,一种传值 。比如voidf1(intv){;}//函数f1v
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语言编写的代码改成c#给你个网站看
推荐阅读
- GIS热力分布图怎么做,arcmap热力图
- oracle数据泵导入报快照过旧,oracle 数据泵导入
- 浦东新区推荐采购代理软件,浦东招标代理公司
- 公众号网站搭建,公众号 搭建
- java画动画矩形代码 java简单动画效果
- 硬盘u盘什么品牌好,哪个硬盘牌子质量好
- 42u标准服务器机柜尺寸,42u服务器机柜宽度
- 钉钉直播连麦多人对话,钉钉直播连麦能看到人吗
- linux的命令输入格式 linux操作系统怎么输入命令