Results 1 to 2 of 2

Thread: help converting vb6 to vbnet

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    1

    Unhappy help converting vb6 to vbnet

    Can anyone help me to fix this vb6 code to run on vb net?

    Option Strict Off
    Option Explicit On
    Friend Class mainFormNEW
    Inherits System.Windows.Forms.Form
    #Region "Windows Form Designer generated code "
    Public Sub New()
    MyBase.New()
    If m_vb6FormDefInstance Is Nothing Then
    If m_InitializingDefInstance Then
    m_vb6FormDefInstance = Me
    Else
    Try
    'For the start-up form, the first instance created is the default instance.
    If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
    m_vb6FormDefInstance = Me
    End If
    Catch
    End Try
    End If
    End If
    'This call is required by the Windows Form Designer.
    InitializeComponent()
    End Sub
    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
    If Disposing Then
    If Not components Is Nothing Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(Disposing)
    End Sub
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
    Public ToolTip1 As System.Windows.Forms.ToolTip
    Public WithEvents readButton As System.Windows.Forms.Button
    Public WithEvents mnuRegistration As System.Windows.Forms.MenuItem
    Public WithEvents mnuFAQ As System.Windows.Forms.MenuItem
    Public WithEvents mnuCredits As System.Windows.Forms.MenuItem
    Public WithEvents mnuInfo As System.Windows.Forms.MenuItem
    Public WithEvents mnuExit As System.Windows.Forms.MenuItem
    Public MainMenu1 As System.Windows.Forms.MainMenu
    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container()
    Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(mainFormNEW))
    Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
    Me.readButton = New System.Windows.Forms.Button()
    Me.MainMenu1 = New System.Windows.Forms.MainMenu()
    Me.mnuRegistration = New System.Windows.Forms.MenuItem()
    Me.mnuInfo = New System.Windows.Forms.MenuItem()
    Me.mnuFAQ = New System.Windows.Forms.MenuItem()
    Me.mnuCredits = New System.Windows.Forms.MenuItem()
    Me.mnuExit = New System.Windows.Forms.MenuItem()
    Me.SuspendLayout()
    '
    'readButton
    '
    Me.readButton.BackColor = System.Drawing.SystemColors.ControlText
    Me.readButton.Cursor = System.Windows.Forms.Cursors.Default
    Me.readButton.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.readButton.ForeColor = System.Drawing.SystemColors.ControlText
    Me.readButton.Image = CType(resources.GetObject("readButton.Image"), System.Drawing.Bitmap)
    Me.readButton.Location = New System.Drawing.Point(368, 352)
    Me.readButton.Name = "readButton"
    Me.readButton.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.readButton.Size = New System.Drawing.Size(329, 201)
    Me.readButton.TabIndex = 0
    Me.readButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter
    Me.ToolTip1.SetToolTip(Me.readButton, "Get A Reading")
    '
    'MainMenu1
    '
    Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuRegistration, Me.mnuInfo, Me.mnuExit})
    '
    'mnuRegistration
    '
    Me.mnuRegistration.Index = 0
    Me.mnuRegistration.Text = "&Registration"
    '
    'mnuInfo
    '
    Me.mnuInfo.Index = 1
    Me.mnuInfo.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFAQ, Me.mnuCredits})
    Me.mnuInfo.Text = "&Information"
    '
    'mnuFAQ
    '
    Me.mnuFAQ.Index = 0
    Me.mnuFAQ.Text = "fAQ"
    '
    'mnuCredits
    '
    Me.mnuCredits.Index = 1
    Me.mnuCredits.Text = "&Credits"
    '
    'mnuExit
    '
    Me.mnuExit.Index = 2
    Me.mnuExit.Text = "&Exit"
    '
    'mainFormNEW
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Bitmap)
    Me.ClientSize = New System.Drawing.Size(312, 213)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.readButton})
    Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
    Me.Location = New System.Drawing.Point(11, 49)
    Me.Menu = Me.MainMenu1
    Me.Name = "mainFormNEW"
    Me.Text = "THE MYSTIC TAROT - YOUR PERSONAL PC PSYCHIC!"
    Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
    Me.ResumeLayout(False)

    End Sub
    #End Region
    #Region "Upgrade Support "
    Private Shared m_vb6FormDefInstance As mainFormNEW
    Private Shared m_InitializingDefInstance As Boolean
    Public Shared Property DefInstance() As mainFormNEW
    Get
    If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
    m_InitializingDefInstance = True
    m_vb6FormDefInstance = New mainFormNEW()
    m_InitializingDefInstance = False
    End If
    DefInstance = m_vb6FormDefInstance
    End Get
    Set
    m_vb6FormDefInstance = Value
    End Set
    End Property
    #End Region


    'UPGRADE_WARNING: Form event mainFormNEW.Unload has a new behavior. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2065"'
    Private Sub mainFormNEW_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed

    'If MsgBox("Are you sure?", vbYesNo, "Exit?") = vbYes Then
    Me.Close()
    'UPGRADE_NOTE: Object mainFormNEW may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1029"'
    mainFormNEW.DefInstance = Nothing
    'Else
    'Cancel = 1
    'End If

    End Sub

    and this drop & drag?
    Public Function DrawCard(ByRef DrawOn As Object, ByVal Card As Short) As Object
    Dim BF As Object
    'Draws a card on an object (Picture box / Form)
    Dim x As Single
    Dim y As Single
    Dim retVal As Integer
    If Card > -1 Then
    x = Pack(Card).xPos
    y = Pack(Card).yPos
    'UPGRADE_WARNING: Couldn't resolve default property of object DrawOn.Line. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
    DrawOn.Line(x, y + 30) ' - (x + 1050, y + 1395), RGB(0, 0, 0), BF)
    'UPGRADE_WARNING: Couldn't resolve default property of object DrawOn.Line. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
    DrawOn.Line(x + 30, y) ' - (x + 1020, y + 1425), RGB(0, 0, 0), BF)
    If Pack(Card).Face = False Then
    cardGraphics.DefInstance.Picture1.Image = VB6.LoadResPicture(Back + 78, VB6.LoadResConstants.ResBitmap)
    Else
    On Error Resume Next
    cardGraphics.DefInstance.Picture1.Image = VB6.LoadResPicture(Pack(Card).Value + 1, VB6.LoadResConstants.ResBitmap)
    End If
    'UPGRADE_ISSUE: Constant vbSrcCopy was not upgraded. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2070"'
    'UPGRADE_ISSUE: PictureBox property Picture1.hDC was not upgraded. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2064"'
    'UPGRADE_WARNING: Couldn't resolve default property of object DrawOn.hDC. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1037"'
    'retVal = BitBlt(DrawOn.hDC, x / 15 + 1, y / 15 + 1, 100, 165, cardGraphics.DefInstance.Picture1, 0, ) 'vbSrcCopy)
    End If
    End Function

  2. #2
    New Member
    Join Date
    Nov 2002
    Posts
    15
    Yup. the .hdc property has been left out. I think you can get it, with the right function calls...

    They went with something called GDI. go to http://msdn.microsoft.com/library/en...asp?frame=true

    You have to make a brand new Graphics object, and play with that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width