locked
[VB2010] - about Automatation instance RRS feed

  • Question

  • i had the sprite(it's a control that i did in VB6) Reference. but why isn't showed(is because don't have the Visible property)?

    Public Class Form1
        Dim sprSprite As Sprite.Sprite2D
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            sprSprite = New Sprite.Sprite2D
            sprSprite.FileName = "C:\Users\Joaquim\Pictures\cora006.jpg"
            sprSprite.AutoSize = True
        End Sub
    End Class

    Wednesday, July 3, 2013 12:31 PM

Answers

  • Thanks for sharing link. This is what Visual Studio IDE generated while I add this control to toolbox and drag to a form:

     <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form7))
            Me.AxSprite2D1 = New AxSprite.AxSprite2D()
            CType(Me.AxSprite2D1, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'AxSprite2D1
            '
            Me.AxSprite2D1.Enabled = True
            Me.AxSprite2D1.Location = New System.Drawing.Point(178, 233)
            Me.AxSprite2D1.Name = "AxSprite2D1"
            Me.AxSprite2D1.OcxState = CType(resources.GetObject("AxSprite2D1.OcxState"), System.Windows.Forms.AxHost.State)
            Me.AxSprite2D1.Size = New System.Drawing.Size(251, 128)
            Me.AxSprite2D1.TabIndex = 0
            '
            'Form7
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(738, 497)
            Me.Controls.Add(Me.AxSprite2D1)
            Me.Name = "Form7"
            Me.Text = "Form7"
            CType(Me.AxSprite2D1, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)
    
        End Sub
        Friend WithEvents AxSprite2D1 As AxSprite.AxSprite2D

    You may add codes like above if you would add control manually.

    Regards,


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Youen Zen Friday, July 19, 2013 8:41 AM
    Friday, July 5, 2013 9:29 AM
  • You could set property of stdole in references, set "Embed interop types" to false to eliminate this warning.

    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Youen Zen Friday, July 19, 2013 8:41 AM
    Friday, July 5, 2013 10:06 AM

All replies

  • I think you may missed adding this control to form, use code like below:

     Me.Controls.Add(sprSprite )

    Hope this helps.

    Regards,


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 5, 2013 5:50 AM
  • I think you may missed adding this control to form, use code like below:

     Me.Controls.Add(sprSprite )

    Hope this helps.

    Regards,


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Public Class Form1
        Dim sprSprite As Sprite.Sprite2D
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            sprSprite = New Sprite.Sprite2D
            Me.Controls.Add(sprprite)
            sprSprite.FileName = "C:\Users\Joaquim\Pictures\cora006.jpg"
            sprSprite.AutoSize = True
        End Sub
    End Class

    error message:

    " 'sprprite' is not declared. It may be inaccessible due to its protection level."

    Friday, July 5, 2013 7:28 AM
  • Moderator Shanks Zen, can i share the ocx file for anyon test it?

    Friday, July 5, 2013 7:33 AM
  • Hi Cambalinho,

    You could share this file via https://skydrive.live.com/, remember to set it as public so that we could help test.


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 5, 2013 7:37 AM
  • Hi Cambalinho,

    You could share this file via https://skydrive.live.com/, remember to set it as public so that we could help test.


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    thanks. my control have some dependency files(was builded in VB6), i will zip all;)

    thanks

    Friday, July 5, 2013 8:25 AM
  • tell me if you can see the Sprite zip file, please.

    https://skydrive.live.com/?cid=c3ef456e15c8deb6#cid=C3EF456E15C8DEB6&id=C3EF456E15C8DEB6!197

    thanks for all

    Friday, July 5, 2013 8:29 AM
  • Thanks for sharing link. This is what Visual Studio IDE generated while I add this control to toolbox and drag to a form:

     <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form7))
            Me.AxSprite2D1 = New AxSprite.AxSprite2D()
            CType(Me.AxSprite2D1, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'AxSprite2D1
            '
            Me.AxSprite2D1.Enabled = True
            Me.AxSprite2D1.Location = New System.Drawing.Point(178, 233)
            Me.AxSprite2D1.Name = "AxSprite2D1"
            Me.AxSprite2D1.OcxState = CType(resources.GetObject("AxSprite2D1.OcxState"), System.Windows.Forms.AxHost.State)
            Me.AxSprite2D1.Size = New System.Drawing.Size(251, 128)
            Me.AxSprite2D1.TabIndex = 0
            '
            'Form7
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(738, 497)
            Me.Controls.Add(Me.AxSprite2D1)
            Me.Name = "Form7"
            Me.Text = "Form7"
            CType(Me.AxSprite2D1, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)
    
        End Sub
        Friend WithEvents AxSprite2D1 As AxSprite.AxSprite2D

    You may add codes like above if you would add control manually.

    Regards,


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Youen Zen Friday, July 19, 2013 8:41 AM
    Friday, July 5, 2013 9:29 AM
  • thanks for answer me;)

    but if i put the control in ToolBox, i see some problems:

    1 - where is the Backcolor and FileName properties(in properties window)?;

    2 - if i enter in property pages, the windows close me the VB2010.

    i don't know why these problems:(

    what i know is have something to do with stdole.dll and interop thing(because i receive the 2 warnings).

    but i don't know how fix it:(

    Friday, July 5, 2013 9:36 AM
  • You could set property of stdole in references, set "Embed interop types" to false to eliminate this warning.

    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Youen Zen Friday, July 19, 2013 8:41 AM
    Friday, July 5, 2013 10:06 AM
  • You could set property of stdole in references, set "Embed interop types" to false to eliminate this warning.

    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    in stdole refeference, yes.

    but i continue with same problems:(

    why i don't see the BackColor and FileName in Properties window?

    why i can't enter in property pages?

    Friday, July 5, 2013 10:15 AM