Here is what I want it to do:
1: My form uses my class library dll to use a command called moveobject
2: My form sends button1 to the byval
3: The button on the form is moving
Here is what it does right now:
1: My form uses my class library dll to use a command called moveobject
2: My form sends button1 to the byval
3: Returning an error
I want to use the objects in the designer in the class library like this (GM is the name of my class library):
This is the form:
[CODE=vbnet] Dim GMF As GM.functions
Private Sub Button8_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button8.Click
GMF.Move_fixed( Me.Button1, "1", 10)
End Sub[/CODE]
This is the class library:
[CODE=vbnet]Public Class functions
Dim way2
Dim obh As Object
Dim sp
Public Function Move_fixed(ByVa l objectname As Object, ByVal way As String, ByVal speed As String)
way2 = way
obh = objectname
timer(speed)
End Function
Dim tt
Public Function timer(ByVal time As String) _
As String
tt = 100
sp = time
InitializeCompo nent()
End Function
Private Sub InitializeCompo nent()
Me.Timer1 = New System.Windows. Forms.Timer
'Timer1
'
Me.Timer1.Inter val = tt
'
'Form1
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles Timer1.Tick
If way2 = "1" Then
With obh
.Left = .Left + sp
.top = .top + sp
End With
End If
If way2 = "2" Then
With obh
.top = .top + sp
End With
End If
If way2 = "3" Then
With obh
.Left = .Left - sp
.top = .top + sp
End With
End If
If way2 = "4" Then
With obh
.Left = .Left + sp
End With
End If
If way2 = "5" Then
Timer1.Enabled = False
Timer1.Stop()
End If
If way2 = "6" Then
With obh
.Left = .Left - sp
End With
End If
If way2 = "7" Then
With obh
.Left = .Left - sp
.top = .top - sp
End With
End If
If way2 = "8" Then
With obh
.top = .top - sp
End With
End If
If way2 = "9" Then
With obh
.Left = .Left + sp
.top = .top - sp
End With
End If
Timer1.Enabled = True
End Sub
Friend WithEvents Timer1 As System.Windows. Forms.Timer
End Class[/CODE]
1: My form uses my class library dll to use a command called moveobject
2: My form sends button1 to the byval
3: The button on the form is moving
Here is what it does right now:
1: My form uses my class library dll to use a command called moveobject
2: My form sends button1 to the byval
3: Returning an error
I want to use the objects in the designer in the class library like this (GM is the name of my class library):
This is the form:
[CODE=vbnet] Dim GMF As GM.functions
Private Sub Button8_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button8.Click
GMF.Move_fixed( Me.Button1, "1", 10)
End Sub[/CODE]
This is the class library:
[CODE=vbnet]Public Class functions
Dim way2
Dim obh As Object
Dim sp
Public Function Move_fixed(ByVa l objectname As Object, ByVal way As String, ByVal speed As String)
way2 = way
obh = objectname
timer(speed)
End Function
Dim tt
Public Function timer(ByVal time As String) _
As String
tt = 100
sp = time
InitializeCompo nent()
End Function
Private Sub InitializeCompo nent()
Me.Timer1 = New System.Windows. Forms.Timer
'Timer1
'
Me.Timer1.Inter val = tt
'
'Form1
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles Timer1.Tick
If way2 = "1" Then
With obh
.Left = .Left + sp
.top = .top + sp
End With
End If
If way2 = "2" Then
With obh
.top = .top + sp
End With
End If
If way2 = "3" Then
With obh
.Left = .Left - sp
.top = .top + sp
End With
End If
If way2 = "4" Then
With obh
.Left = .Left + sp
End With
End If
If way2 = "5" Then
Timer1.Enabled = False
Timer1.Stop()
End If
If way2 = "6" Then
With obh
.Left = .Left - sp
End With
End If
If way2 = "7" Then
With obh
.Left = .Left - sp
.top = .top - sp
End With
End If
If way2 = "8" Then
With obh
.top = .top - sp
End With
End If
If way2 = "9" Then
With obh
.Left = .Left + sp
.top = .top - sp
End With
End If
Timer1.Enabled = True
End Sub
Friend WithEvents Timer1 As System.Windows. Forms.Timer
End Class[/CODE]
Comment