Results 1 to 15 of 15

Thread: Class Module - convert from VB6

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2005
    Posts
    61

    Class Module - convert from VB6

    New to both VB6 and VB.NET but trying to learn both...
    i created a class module (which is working) in VB6...
    can't seem to figure out how to get same functionality in VB.NET....any help would be great...this is what i have in VB6....all applicable controls are named cmd00 to cmd09...this is fairly simple and just have buttons for #'s 0-9...that when clicked just concatenate to the end of a text box (txtCurScore)...any help ".NETing" this would be appreciated...

    In Standard Module
    VB Code:
    1. Dim Buttons01() As New cls01
    2. Sub OpenMainForm()                                
    3.   Dim ctl As Control
    4.   Dim cnt01 As Integer
    5.   For Each ctl In Form1.Controls
    6.     If TypeOf ctl Is CommandButton Then
    7.       If Left(ctl.Name, 4) = "cmd0" Then
    8.         cnt01 = cnt01 + 1
    9.         ReDim Preserve Buttons01(1 To cnt01)
    10.         Set Buttons01(cnt01).Buttons01Class = ctl
    11.       End If
    12.     End If
    13.   Next ctl
    14.   vForm.Show
    15.   vForm.Refresh
    16. End Sub

    In Standard Module
    VB Code:
    1. Sub Group01()
    2.   Form1.txtCurScore.Text = Form1.txtCurScore.Text & Val(Right(Form1.ActiveControl.Name, 1))
    3. End Sub


    In Class Module
    VB Code:
    1. Public WithEvents Buttons01Class As CommandButton
    2.  
    3. Private Sub Buttons01Class_click()
    4.   Group01
    5. End Sub
    Last edited by TheNoocH; Oct 16th, 2006 at 02:37 PM.

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