Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. conversion of C# to vb code

conversion of C# to vb code

Scheduled Pinned Locked Moved ASP.NET
csharp
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    biswa47
    wrote on last edited by
    #1

    what wil be the correspomding vb.net code for this:- if(!Convert.IsDBNull(TxtBxMp .Value) { cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32); }

    C I B V D 5 Replies Last reply
    0
    • B biswa47

      what wil be the correspomding vb.net code for this:- if(!Convert.IsDBNull(TxtBxMp .Value) { cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32); }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Well, this is not valid code. It's missing a ), and CType is already nasty VB code, C# does not support it ( I just double checked ). Replace the ! with Not, replace the {} with then and endif, remove the semicolon, and you're probably there.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • B biswa47

        what wil be the correspomding vb.net code for this:- if(!Convert.IsDBNull(TxtBxMp .Value) { cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32); }

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        hi First of all C# doesnt support CType VB code If Not Convert.IsDBNull(TxtBxMp .Value) Then cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32) End If Best regard Pathan

        ---------------------------------------------------

        B 1 Reply Last reply
        0
        • I Imran Khan Pathan

          hi First of all C# doesnt support CType VB code If Not Convert.IsDBNull(TxtBxMp .Value) Then cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32) End If Best regard Pathan

          ---------------------------------------------------

          B Offline
          B Offline
          biswa47
          wrote on last edited by
          #4

          ya , i also think so. but i had problem which i posted over here in response i got this soln. . the problem is: there are textboxes where i am entereing the int type value.here i am using sp to save the value.if i am giving all the values in the textboxes the its working fine.but if i am not giving all the values in the textbox means if i left some textbox with giving any value .then its showing error as:" Message="Conversion from string " to type 'Integer' is not valid.". where i have written the code as" cmd.Parameters.Add("@no_mp_record", Data.SqlDbType.Int) cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32) " and in the database i have defined its value as null and also in storeprocedure i have done accaordingly. i have executed the sp seperately n its working. why i am getting the error. or what will be solution for the error

          I 1 Reply Last reply
          0
          • B biswa47

            ya , i also think so. but i had problem which i posted over here in response i got this soln. . the problem is: there are textboxes where i am entereing the int type value.here i am using sp to save the value.if i am giving all the values in the textboxes the its working fine.but if i am not giving all the values in the textbox means if i left some textbox with giving any value .then its showing error as:" Message="Conversion from string " to type 'Integer' is not valid.". where i have written the code as" cmd.Parameters.Add("@no_mp_record", Data.SqlDbType.Int) cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32) " and in the database i have defined its value as null and also in storeprocedure i have done accaordingly. i have executed the sp seperately n its working. why i am getting the error. or what will be solution for the error

            I Offline
            I Offline
            Imran Khan Pathan
            wrote on last edited by
            #5

            TextBox.Text Return String If u pass nothing then it return String.Empty means "" and It can not convert "" to Int.Thats why u r getting this error. Pass 0 if TextBox.Text=String.Empty Or Pass String Value to SP Instead Of Int. Best Regard Pathan

            ---------------------------------------------------

            1 Reply Last reply
            0
            • B biswa47

              what wil be the correspomding vb.net code for this:- if(!Convert.IsDBNull(TxtBxMp .Value) { cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32); }

              B Offline
              B Offline
              ballameharmurali
              wrote on last edited by
              #6

              hello biswa, it is better to go to google and type the conversion code u will get the conversion code.OK byeee Murali Murali

              1 Reply Last reply
              0
              • B biswa47

                what wil be the correspomding vb.net code for this:- if(!Convert.IsDBNull(TxtBxMp .Value) { cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32); }

                V Offline
                V Offline
                Vasudevan Deepak Kumar
                wrote on last edited by
                #7

                If Not Convert.IsDBNull(TxtBxMp .Value Then cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32) End If '---------------------------------------------------------------- ' Converted from C# to VB .NET using CSharpToVBConverter(1.2). ' Developed by: Kamal Patel (http://www.KamalPatel.net) '---------------------------------------------------------------- Powered by: http://www.kamalpatel.net/ConvertCSharp2VB.aspx[^]

                Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                1 Reply Last reply
                0
                • B biswa47

                  what wil be the correspomding vb.net code for this:- if(!Convert.IsDBNull(TxtBxMp .Value) { cmd.Parameters("@no_mp_record").Value = CType(TxtBxMp.Text, Int32); }

                  D Offline
                  D Offline
                  DarynRoberts
                  wrote on last edited by
                  #8

                  Hey there. Check out this cool site....it will convert the code for you. Ive used it and it works well. http://labs.developerfusion.co.uk ciao

                  Dazz

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups