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. General Programming
  3. Visual Basic
  4. some problem when change C# to VB.net

some problem when change C# to VB.net

Scheduled Pinned Locked Moved Visual Basic
helpcsharpquestion
4 Posts 4 Posters 1 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.
  • G Offline
    G Offline
    Golden Jing
    wrote on last edited by
    #1

    Under is some code of C#, i would like all of you to show me how can to VB.net because i don't know C# at all and i don't know this code as well. Thanks for your help... public partial class frmMain : Form { public frmMain() { InitializeComponent(); allStands = new List[] { Stand1plates, Stand2plates, Stand3plates }; // Stand2plates.Add(3); } List[] allStands; List Stand1plates = new List(); List Stand2plates = new List(); List Stand3plates = new List(); private void MoveFromTo(int source, int dest) { int top = allStands[source-1][allStands[source-1].Count - 1]; allStands[source - 1].Remove(top); allStands[dest-1].Add(top); RedrawPanels(); } ================================= I change it to VB.net as bellow: Public Class Form1 Inherits Form Public Sub New() InitializeComponent() ' Stand2plates.Add(3); allStands = New List() {Stand1plates, Stand2plates, Stand3plates} End Sub Private allStands As List(Of Integer) Private Stand1plates As New List(Of Integer) Private Stand2plates As New List(Of Integer) Private Stand3plates As New List(Of Integer) Private Sub MoveFromTo(ByVal source As Integer, ByVal dest As Integer) Dim top As Integer = allStands(source - 1)(allStands(source - 1).Count - 1) allStands(source - 1).Remove(top) allStands(dest - 1).Add(top) RedrawPanels() End Sub End Sub but it has error where underline. what's problem ? How do i change it ? Thanks for your helps.

    VB.Net

    M T L 3 Replies Last reply
    0
    • G Golden Jing

      Under is some code of C#, i would like all of you to show me how can to VB.net because i don't know C# at all and i don't know this code as well. Thanks for your help... public partial class frmMain : Form { public frmMain() { InitializeComponent(); allStands = new List[] { Stand1plates, Stand2plates, Stand3plates }; // Stand2plates.Add(3); } List[] allStands; List Stand1plates = new List(); List Stand2plates = new List(); List Stand3plates = new List(); private void MoveFromTo(int source, int dest) { int top = allStands[source-1][allStands[source-1].Count - 1]; allStands[source - 1].Remove(top); allStands[dest-1].Add(top); RedrawPanels(); } ================================= I change it to VB.net as bellow: Public Class Form1 Inherits Form Public Sub New() InitializeComponent() ' Stand2plates.Add(3); allStands = New List() {Stand1plates, Stand2plates, Stand3plates} End Sub Private allStands As List(Of Integer) Private Stand1plates As New List(Of Integer) Private Stand2plates As New List(Of Integer) Private Stand3plates As New List(Of Integer) Private Sub MoveFromTo(ByVal source As Integer, ByVal dest As Integer) Dim top As Integer = allStands(source - 1)(allStands(source - 1).Count - 1) allStands(source - 1).Remove(top) allStands(dest - 1).Add(top) RedrawPanels() End Sub End Sub but it has error where underline. what's problem ? How do i change it ? Thanks for your helps.

      VB.Net

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      Sovann wrote:

      i don't know C# at all and i don't know this code as well.

      God bless you.

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      1 Reply Last reply
      0
      • G Golden Jing

        Under is some code of C#, i would like all of you to show me how can to VB.net because i don't know C# at all and i don't know this code as well. Thanks for your help... public partial class frmMain : Form { public frmMain() { InitializeComponent(); allStands = new List[] { Stand1plates, Stand2plates, Stand3plates }; // Stand2plates.Add(3); } List[] allStands; List Stand1plates = new List(); List Stand2plates = new List(); List Stand3plates = new List(); private void MoveFromTo(int source, int dest) { int top = allStands[source-1][allStands[source-1].Count - 1]; allStands[source - 1].Remove(top); allStands[dest-1].Add(top); RedrawPanels(); } ================================= I change it to VB.net as bellow: Public Class Form1 Inherits Form Public Sub New() InitializeComponent() ' Stand2plates.Add(3); allStands = New List() {Stand1plates, Stand2plates, Stand3plates} End Sub Private allStands As List(Of Integer) Private Stand1plates As New List(Of Integer) Private Stand2plates As New List(Of Integer) Private Stand3plates As New List(Of Integer) Private Sub MoveFromTo(ByVal source As Integer, ByVal dest As Integer) Dim top As Integer = allStands(source - 1)(allStands(source - 1).Count - 1) allStands(source - 1).Remove(top) allStands(dest - 1).Add(top) RedrawPanels() End Sub End Sub but it has error where underline. what's problem ? How do i change it ? Thanks for your helps.

        VB.Net

        T Offline
        T Offline
        Tom Deketelaere
        wrote on last edited by
        #3

        1: next time post the error you get 2: before you post here read the error to few arguments to ... paints a pretty clear picture of what is wrong 3: to solve this change 'private allstands as list(of integer)' to 'private allstands as list(of list(of integer)) and in the constructor (public sub new in case you do not know) put the following: allStands = New List(Of List(Of Integer)) allStands.Add(Stand1plates) allStands.Add(Stand2plates) allStands.Add(Stand3plates) this should work

        1 Reply Last reply
        0
        • G Golden Jing

          Under is some code of C#, i would like all of you to show me how can to VB.net because i don't know C# at all and i don't know this code as well. Thanks for your help... public partial class frmMain : Form { public frmMain() { InitializeComponent(); allStands = new List[] { Stand1plates, Stand2plates, Stand3plates }; // Stand2plates.Add(3); } List[] allStands; List Stand1plates = new List(); List Stand2plates = new List(); List Stand3plates = new List(); private void MoveFromTo(int source, int dest) { int top = allStands[source-1][allStands[source-1].Count - 1]; allStands[source - 1].Remove(top); allStands[dest-1].Add(top); RedrawPanels(); } ================================= I change it to VB.net as bellow: Public Class Form1 Inherits Form Public Sub New() InitializeComponent() ' Stand2plates.Add(3); allStands = New List() {Stand1plates, Stand2plates, Stand3plates} End Sub Private allStands As List(Of Integer) Private Stand1plates As New List(Of Integer) Private Stand2plates As New List(Of Integer) Private Stand3plates As New List(Of Integer) Private Sub MoveFromTo(ByVal source As Integer, ByVal dest As Integer) Dim top As Integer = allStands(source - 1)(allStands(source - 1).Count - 1) allStands(source - 1).Remove(top) allStands(dest - 1).Add(top) RedrawPanels() End Sub End Sub but it has error where underline. what's problem ? How do i change it ? Thanks for your helps.

          VB.Net

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Arrrggghhh! This code won't go away!

          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