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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem converting c# to vb.net [modified]

Problem converting c# to vb.net [modified]

Scheduled Pinned Locked Moved Visual Basic
csharpcomgraphicsdesign
3 Posts 2 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.
  • J Offline
    J Offline
    Jan Sommer
    wrote on last edited by
    #1

    Hi I'm trying to convert http://www.codeproject.com/KB/tabs/tabstrips.aspx[^] to vb.net, but have encountered a few problems.. There's 8 errors that i just can't figure out how to deal with, so maybe some of you can solve it.. Here's the code (the errors at bottom):

    Imports System
    Imports System.Collections.Generic
    Imports System.Text
    Imports System.Windows.Forms
    Imports System.Drawing
    Imports System.Drawing.Drawing2D
    Imports System.Windows.Forms.VisualStyles
    Imports VisualStyles = System.Windows.Forms.VisualStyles
    Imports System.ComponentModel
    Imports System.ComponentModel.Design
    Imports System.Collections
    Imports System.Windows.Forms.Design

    Namespace Messir.Windows.Forms
    Public Class SelectedTabChangedEventArgs
    Inherits EventArgs
    Public SelectedTab As TabStripButton

        Public Sub SelectedTabChangedEventArgs(ByVal tab As TabStripButton)
            SelectedTab = tab
        End Sub
    End Class
    
    ''' <summary>
    ''' Represents a TabStrip control
    ''' </summary>
    Public Class TabStrip
        Inherits ToolStrip
    
        Private myRenderer As New TabStripRenderer()
        Protected mySelTab As TabStripButton
        Dim insPage As DesignerVerb = Nothing
    
        Public Sub TabStrip()
            'MyBase.new()
            InitControl()
        End Sub
    
        Public Sub New(ByVal ParamArray buttons() As TabStripButton)
            MyBase.New(buttons)
            InitControl()
        End Sub
    
        Protected Sub InitControl()
            MyBase.RenderMode = ToolStripRenderMode.ManagerRenderMode
            MyBase.Renderer = myRenderer
            myRenderer.RenderMode = Me.RenderStyle
            insPage = New DesignerVerb("Insert tab page", New EventHandler(AddressOf OnInsertPageClicked))
        End Sub
    
        Public Overrides Property Site() As ISite
            Get
                Dim curSite As ISite = MyBase.Site
                If ((Not (curSite) Is Nothing) \_
                            AndAlso curSite.DesignMode) Then
                    Dim comp As IContainer = curSite.Container
                    If (Not (comp) Is Nothing) Then
                        Dim host As IDesignerHost = CType(comp, IDesignerHost)
                        If (Not (host) Is Nothing) Then
                            Dim designer As IDesigner = hos
    
    C 1 Reply Last reply
    0
    • J Jan Sommer

      Hi I'm trying to convert http://www.codeproject.com/KB/tabs/tabstrips.aspx[^] to vb.net, but have encountered a few problems.. There's 8 errors that i just can't figure out how to deal with, so maybe some of you can solve it.. Here's the code (the errors at bottom):

      Imports System
      Imports System.Collections.Generic
      Imports System.Text
      Imports System.Windows.Forms
      Imports System.Drawing
      Imports System.Drawing.Drawing2D
      Imports System.Windows.Forms.VisualStyles
      Imports VisualStyles = System.Windows.Forms.VisualStyles
      Imports System.ComponentModel
      Imports System.ComponentModel.Design
      Imports System.Collections
      Imports System.Windows.Forms.Design

      Namespace Messir.Windows.Forms
      Public Class SelectedTabChangedEventArgs
      Inherits EventArgs
      Public SelectedTab As TabStripButton

          Public Sub SelectedTabChangedEventArgs(ByVal tab As TabStripButton)
              SelectedTab = tab
          End Sub
      End Class
      
      ''' <summary>
      ''' Represents a TabStrip control
      ''' </summary>
      Public Class TabStrip
          Inherits ToolStrip
      
          Private myRenderer As New TabStripRenderer()
          Protected mySelTab As TabStripButton
          Dim insPage As DesignerVerb = Nothing
      
          Public Sub TabStrip()
              'MyBase.new()
              InitControl()
          End Sub
      
          Public Sub New(ByVal ParamArray buttons() As TabStripButton)
              MyBase.New(buttons)
              InitControl()
          End Sub
      
          Protected Sub InitControl()
              MyBase.RenderMode = ToolStripRenderMode.ManagerRenderMode
              MyBase.Renderer = myRenderer
              myRenderer.RenderMode = Me.RenderStyle
              insPage = New DesignerVerb("Insert tab page", New EventHandler(AddressOf OnInsertPageClicked))
          End Sub
      
          Public Overrides Property Site() As ISite
              Get
                  Dim curSite As ISite = MyBase.Site
                  If ((Not (curSite) Is Nothing) \_
                              AndAlso curSite.DesignMode) Then
                      Dim comp As IContainer = curSite.Container
                      If (Not (comp) Is Nothing) Then
                          Dim host As IDesignerHost = CType(comp, IDesignerHost)
                          If (Not (host) Is Nothing) Then
                              Dim designer As IDesigner = hos
      
      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      No-one is going to trawl through all this source to try to find which line is 207. I'd guess that the operator = error has to do with VB doing an implicit conversion to a type that does have operator =. Error 4 is self explanatory. VB sucks. It won't let you call an event, you have to call RaiseEvent. Error 5 looks like the convertor has failed to properly convert a constructor, at a guess Error 6, 7, and 8 are all because VB sucks and is not case sensitive. The original code had Mirrored and mirrored defined ( probably as a private variable and a public property. Change mirrored to _mirrored through the code, and then they will not collide.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      J 1 Reply Last reply
      0
      • C Christian Graus

        No-one is going to trawl through all this source to try to find which line is 207. I'd guess that the operator = error has to do with VB doing an implicit conversion to a type that does have operator =. Error 4 is self explanatory. VB sucks. It won't let you call an event, you have to call RaiseEvent. Error 5 looks like the convertor has failed to properly convert a constructor, at a guess Error 6, 7, and 8 are all because VB sucks and is not case sensitive. The original code had Mirrored and mirrored defined ( probably as a private variable and a public property. Change mirrored to _mirrored through the code, and then they will not collide.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        J Offline
        J Offline
        Jan Sommer
        wrote on last edited by
        #3

        You're right about noone is going to debug all that code. Guess i was a little naive to believe in that. I've found another control that does pretty much the same and in vb.net. But thanks for trying to help. Maybe i should try out c# some day :)

        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