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:
Expand|Select|Wrap|Line Numbers
- Dim GMF As GM.functions
- Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
- GMF.Move_fixed(Me.Button1, "1", 10)
- End Sub
Expand|Select|Wrap|Line Numbers
- Public Class functions
- Dim way2
- Dim obh As Object
- Dim sp
- Public Function Move_fixed(ByVal 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
- InitializeComponent()
- End Function
- Private Sub InitializeComponent()
- Me.Timer1 = New System.Windows.Forms.Timer
- 'Timer1
- '
- Me.Timer1.Interval = tt
- '
- 'Form1
- Timer1.Enabled = True
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) 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