Problem converting c# to vb.net [modified]
-
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.DesignNamespace Messir.Windows.Forms
Public Class SelectedTabChangedEventArgs
Inherits EventArgs
Public SelectedTab As TabStripButtonPublic 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
-
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.DesignNamespace Messir.Windows.Forms
Public Class SelectedTabChangedEventArgs
Inherits EventArgs
Public SelectedTab As TabStripButtonPublic 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
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 )
-
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 )
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 :)