|
-
Dec 15th, 2000, 09:45 PM
#1
Thread Starter
Member
I have a question????? regarding an axtive x control
I am new to writing these axctive x controls but I thought it would be a good skill to learn. I took the Karl Moore tutorial and now I am trying to write my own. It is a dice control which I know has been written before my big prob is that when I try to run this control in a project it opens up in internet explorer what am I doing wrong. Thanxs for any help
code
Option Explicit
Dim intDiceRoll As Integer
Dim m_roll As Roll
'Property Variables:
Dim m_def_roll
'Event Declarations:
Public Event Click() 'MappingInfo=UserControl,UserControl,-1,Click
Public Event ReadProperties(PropBag As PropertyBag)
Public Event WriteProperties(PropBag As PropertyBag)
Public Enum Roll
Random
One
Two
Three
Four
Five
Six
End Enum
Private Sub UserControl_Click()
RaiseEvent Click
intDiceRoll = Int(Rnd * 6) + 1
Roll_Die
End Sub
Private Sub Roll_Die()
Dim intValue As Integer
Select Case intDiceRoll
Case 1
shpOne.Visible = False
shpTwo.Visible = False
shpThree.Visible = False
shpfour.Visible = True
shpFive.Visible = False
shpsix.Visible = False
shpSeven.Visible = False
intValue = 1
Case 2
shpOne.Visible = True
shpTwo.Visible = False
shpThree.Visible = False
shpfour.Visible = False
shpFive.Visible = False
shpsix.Visible = False
shpSeven.Visible = True
intValue = 2
Case 3
shpOne.Visible = True
shpTwo.Visible = False
shpThree.Visible = False
shpfour.Visible = True
shpFive.Visible = False
shpsix.Visible = False
shpSeven.Visible = True
intValue = 3
Case 4
shpOne.Visible = True
shpTwo.Visible = True
shpThree.Visible = False
shpfour.Visible = False
shpFive.Visible = False
shpsix.Visible = True
shpSeven.Visible = True
intValue = 4
Case 5
shpOne.Visible = True
shpTwo.Visible = True
shpThree.Visible = False
shpfour.Visible = True
shpFive.Visible = False
shpsix.Visible = True
shpSeven.Visible = True
intValue = 5
Case 6
shpOne.Visible = True
shpTwo.Visible = True
shpThree.Visible = True
shpfour.Visible = False
shpFive.Visible = True
shpsix.Visible = True
shpSeven.Visible = True
intValue = 6
End Select
End Sub
Private Sub UserControl_Resize()
With shpDice
.Height = UserControl.ScaleHeight
.Top = UserControl.ScaleTop
.Left = UserControl.ScaleLeft
.Width = UserControl.ScaleWidth
End With
End Sub
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=14,0,0,0
Public Property Get Roll() As Roll
Roll = m_roll
End Property
Public Property Let Roll(ByVal New_Roll As Roll)
m_roll = New_Roll
If m_roll = Random Then
m_roll = Int(Rnd * 6) + 1
End If
intDiceRoll = m_roll
Roll_Die
PropertyChanged "Roll"
End Property
'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
m_def_roll = intDiceRoll
m_roll = m_def_roll
End Sub
'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_roll = PropBag.ReadProperty("Roll", m_roll)
End Sub
'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Roll", m_roll, m_roll)
End Sub
-
Dec 16th, 2000, 05:59 AM
#2
Junior Member
That's MS/VB standard behaviour, using IE as Container.
You have to compile your project (i.e. make .ocx), start a new project and add your ocx.(right click on the components bar, then browse to your new file). Karls otherwise great tut skips that step.
-
Dec 16th, 2000, 09:18 AM
#3
Fanatic Member
You don't have to compile it to an OCX file to test your control, all you need to do is add a Standard EXE project (File / Add Project) and set the standard exe project as Start Up (by right clicking on the Standard EXE project in the Project Explorer) and assure that you have closed all the windows for the ActiveX Control, then just create an instance of your control on the form in the Standard Project.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Dec 17th, 2000, 02:03 AM
#4
Thread Starter
Member
thanxs I guess I wasnt thinking about that
-
Dec 17th, 2000, 11:12 AM
#5
Junior Member
Yep, YoungBuck is right, of course!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|