_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#给你个网站看
可在线将vb.net代码转成c#的,我用过,还可以的,但是转后也要改动一些 。这里还有将c#转vb.net的 。
这是我转的:
string[] ArrValue = https://www.04ip.com/post/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 = https://www.04ip.com/post/null;
if (MMonth == 1 | MMonth == 3 | MMonth == 5 | MMonth == 7 | MMonth == 8 | MMonth == 10 | MMonth == 12) {
functionReturnValue = https://www.04ip.com/post/31;
}
else {
if (MMonth == 4 | MMonth == 6 | MMonth == 9 | MMonth == 11) {
functionReturnValue = https://www.04ip.com/post/30;
}
else {
if (((YYear % 4 == 0)(YYear % 100 != 0)) | (YYear % 400 == 0)) {
functionReturnValue = https://www.04ip.com/post/29;
}
else {
functionReturnValue = https://www.04ip.com/post/28;
}
}
}
return functionReturnValue;
}
vb.net代码转c的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb6转vbnet、vb.net代码转c的信息别忘了在本站进行查找喔 。
推荐阅读
- 郑州花店运营直播,郑州花店送花业务
- 仓库系统erp好学吗工资高吗,仓库erp系统软件有哪些
- gis母线做哪些实验,gis封闭母线内部图片
- php函数行数据 php处理数据
- redis查看集合名称,redis修改key的名称
- 电脑ps怎么打印a4图,电脑ps怎么打印照片
- angular用jquery,angular生命周期
- python的s函数描述 python中%s的用法
- nvme搭配什么CPU,nvme选择