我想将VB.Net代码转换为C#.Net [英] I Want To Transfrom VB.Net Code into C#.Net

查看:111
本文介绍了我想将VB.Net代码转换为C#.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Public Class add_course

    Dim ds As New DataSet1
    Dim ta As New DataSet1TableAdapters.Course_NameTableAdapter


    Private Sub btnadd_course_Click(sender As Object, e As EventArgs) Handles btnadd_course.Click
        Try

        
        Dim flag_addcourse As Boolean = False

        If tbcourse_name.Text = "" Or
            tbdepartment.Text = "" Or
            tbdescription.Text = "" Or
            tbtype.Text = "" Then
            MsgBox("All Field Are Mandatory")

        Else
            ta.Fill(ds.Course_Name)
            For i = 0 To ds.Course_Name.Rows.Count - 1


                If tbcourse_name.Text.ToLower = ds.Course_Name.Rows(i)("course_name").ToString.ToLower Then
                    flag_addcourse = True
                    Exit For
                End If
            Next
            If flag_addcourse = True Then
                MsgBox("Course Is Already Exits")
            Else


                Dim dr As DataRow = ds.Course_Name.NewRow
                dr("course_name") = tbcourse_name.Text
                dr("Type") = tbtype.Text

                dr("description") = tbdescription.Text
                dr("dept") = tbdepartment.Text

                ds.Course_Name.Rows.Add(dr)
                ta.Update(ds.Course_Name)
                MsgBox("Successfull Entry In Database")
                tbcourse_name.Text = ""
                tbdepartment.Text = ""
                tbdescription.Text = ""
                tbtype.Text = ""

            End If
            End If
        Catch ex As Exception
            MessageBox.Show("Please Close The Window")
        End Try
    End Sub

    Private Sub btnexit_Click(sender As Object, e As EventArgs) Handles btnexit.Click
        Me.Dispose()
       
    End Sub

End Class

推荐答案

尝试在线转换器。



1. 将VB.NET转换为C# [ ^ ]

2. 转换VB到C#或C#到VB [ ^ ]
Try online converters.

1. Convert VB.NET to C#[^]
2. Convert VB to C# or C# to VB[^]


两者之间最强大的自动转换方式实际上是脱机的。你可以使用ILSpy(你也可以使用Reflector,但ILSpy是开源的,质量非常好):

http://en.wikipedia.org/wiki/.NET_Reflector [ ^ ],

http://www.ilspy.net/ [ ^ ]。



我在过去的答案中解释了如何使用它并在这里提到了一些很好的在线工具:

代码解释,C#到VB.NET [ ^ ],

需要将vb代码转换为c# [ ^ ],

FixedPage to ContentPage将c#代码转换为vb.net [ ^ ],

来自exe的源代码 [ ^ ]。br />


-SA
The most robust way of automatic translation between the two is actually off-line. You can use ILSpy (you can also use Reflector, but ILSpy is open-source and the quality if very good):
http://en.wikipedia.org/wiki/.NET_Reflector[^],
http://www.ilspy.net/[^].

I explained how to use it and also mentioned some good on-line tools here, in my past answers:
Code Interpretation, C# to VB.NET[^],
Need to convert vb code to c#[^],
FixedPage to ContentPage convert c# code into vb.net[^],
Source Code from a exe[^].

—SA


我使用过SharpDevelop它不仅将VB转换为C#而且还将其转换为-versa,不仅如此,它还可以转换为其他语言,如python,Ruby等。
I have used "SharpDevelop" it not only converts VB to C# but also vice-versa and not only this it offers conversion to other languages like python,Ruby and etc.


这篇关于我想将VB.Net代码转换为C#.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆