c转vb.net在线 vb60转net
请帮忙将以下C语言代码转换为VB.NET代码,谢谢!
Option Explicit On
创新互联专注于益阳网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供益阳营销型网站建设,益阳网站制作、益阳网页设计、益阳网站官网定制、微信小程序开发服务,打造益阳网络公司原创品牌,更为您提供益阳网站排名全网营销落地服务。
Option Strict On
Imports System
Module Program
Sub Main()
Dim y,m,t As Integer
begin:
' 输入数据时一行一个
y=CInt(Console.ReadLine())
m=CInt(Console.ReadLine())
t=CInt(Console.ReadLine())
If y100 Then
y=y+2000
End If
If y1916 OrElse m200 Then
Console.WriteLine("ERROR")
goto begin
End If
pr(y,m,t)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Function pr(y As Integer,m As Integer,t As Integer) As Integer
Dim ye,[Me],i As Integer
ye=CInt((m+t-2)/12+y)
[Me]=(m+t-2) Mod 12+1
Console.WriteLine(" {0}-{1} ~ {2}-{3}",y,m,ye,[Me])
ye=y
[Me]=m
For i=0 To t-1
prmonth(ye,[me])
[Me]=[Me]+1
If [Me]12 Then
ye=ye+1
[me]=1
End If
Next
Return 0
End Function
Function yam(y As Integer,m As Integer) As Integer
Dim st As String()={"未定义","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
Console.WriteLine(" {0} {1}",y,st(m))
Console.WriteLine("----------------------------")
Return 0
End Function
Function ryear(y As Integer) As Integer
If 0=y Mod 400 OrElse (0y Mod 100 AndAlso 0=y Mod 4) Then
Return 1
Else
Return 0
End If
End Function
Function mday(y As Integer,m As Integer) As Integer
Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}
Dim ad As Integer=0
If 2=m Then
ad=ryear(y)
End If
Return day(m)+ad
End Function
Function monday(y As Integer,m As Integer) As Integer
Dim md As Integer=6
Dim i,daynum As Integer
For i=1916 To y-1
daynum=365+ryear(i)
md=(md+daynum) Mod 7
Next
For i=1 To m-1
md=(md+mday(y,i)) Mod 7
Next
Return md
End Function
Function prmonth(y As Integer,m As Integer) As Integer
Dim md As Integer=monday(y,m)
Dim daysnum As Integer=mday(y,m)
Dim days As Integer=daysnum+md
Dim i As Integer
yam(y,m)
Console.Write(" 日 一 二 三 四 五 六")
For i=0 To days-1
If 0=i Mod 7 Then
Console.WriteLine()
Console.WriteLine()
Console.Write(" ")
End If
If i-md=0 Then
Console.Write(" {0,2}",i-md+1)
Else
Console.Write(" ")
End If
Next
Console.WriteLine()
Console.WriteLine()
Return 0
End Function
End Module
vb.net中的数据强制转化问题,谁帮我把这段C#转化为VB.net的语言
强制类型转换在VB.NET中用Ctype()函数实现的。
Dim drv As DataRowView = CType(comboBox1.SelectedItem, DataRowView)
另外:comboBox1.SelectedItem 不是 string 类型,而是 object 类型。ComboBox 下拉显示文字是通过调用 Object.ToString() 方法实现的。
C语言转换为VB.NET
Option Explicit On
Option Strict On
Imports System
Module Program
Sub Main()
Dim y,m,t As Integer
begin:
' 输入数据时一行一个
y=CInt(Console.ReadLine())
m=CInt(Console.ReadLine())
t=CInt(Console.ReadLine())
If y
200 Then
Console.WriteLine("ERROR")
goto begin
End If
pr(y,m,t)
Console.Write("Press any key to continue . . . ")
Console.ReadKey(True)
End Sub
Function pr(y As Integer,m As Integer,t As Integer) As Integer
Dim ye,[Me],i As Integer
ye=CInt((m+t-2)/12+y)
[Me]=(m+t-2) Mod 12+1
End If
End Function
Function mday(y As Integer,m As Integer) As Integer
Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}
Dim ad As I
如何将C#语言转换为VB.net语言?
晕,我下过这么个软件,就是从C#转换成VB.NET
不过
我找到了一个网址
打开就可以了
在线翻译
怎样把VC++代码转换成VB代码
1.定义量
我首先看第例:
#define STD_COPY1//COMMCTRL.H
VC++代码用#define定义量,VB用Const定义,转换VB代码:
Public ConstSTD_COPY=1
第二例:
#define LB_SELECTSTRING0x018C//WINUSER.h
问题,VC++所"0x"值十六进制,VB表示十六进制要用"H".转换VB代码:
Const LB_SELECTSTRING=0x018C
C#.net转VB.net问题
Public Sub responseMsg(postStr As String)
Dim postObj As System.Xml.XmlDocument = New System.Xml.XmlDocument()
postObj.LoadXml(postStr)
WriteLog("responseMsg:-------" + postStr)
Dim FromUserNameList = postObj.GetElementsByTagName("FromUserName")
Dim FromUserName As String = String.Empty
For i As Integer = 0 To FromUserNameList.Count - 1
If FromUserNameList(i).ChildNodes(0).NodeType = System.Xml.XmlNodeType.CDATA Then
FromUserName = FromUserNameList(i).ChildNodes(0).Value
End If
Next i
Dim toUsernameList = postObj.GetElementsByTagName("ToUserName")
Dim ToUserName As String = String.Empty
For i As Integer = 0 To toUsernameList.Count - 1
If toUsernameList(i).ChildNodes(0).NodeType = System.Xml.XmlNodeType.CDATA Then
ToUserName = toUsernameList(i).ChildNodes(0).Value
End If
Next i
Dim keywordList = postObj.GetElementsByTagName("Content")
Dim Content As String = String.Empty
For i As Integer = 0 To keywordList.Count - 1
If keywordList(i).ChildNodes(0).NodeType = System.Xml.XmlNodeType.CDATA Then
Content = keywordList(i).ChildNodes(0).Value
End If
Next i
Dim time = DateTime.Now
Dim textpl = "xmlToUserName![CDATA[" + FromUserName + "]]/ToUserName" + _
"FromUserName![CDATA[" + ToUserName + "]]/FromUserName" + _
"CreateTime" + ConvertDateTimeInt(DateTime.Now) + "/CreateTimeMsgType![CDATA[text]]/MsgType" + _
"Content![CDATA[欢迎来到微信世界---" + Content + "]]/ContentFuncFlag0/FuncFlag/xml "
context.Response.Write(textpl)
context.Response.End()
End Sub
网页名称:c转vb.net在线 vb60转net
URL链接:http://scyanting.com/article/hioipi.html