Solved

Clean Up My Code

Posted on 2002-03-23
22
191 Views
Last Modified: 2010-05-02
Hi All: Im a newbie to VB and am taking a course in it at the moment. I have written up a small program and would like for a VB Pro to look over it for me and basically clean it up a bit.

If you can help me out, please post your Email address here so I can Email you my project.

Thank-You in advance - S.V.P.A.M
0
Comment
Question by:svpam
  • 9
  • 8
  • 2
  • +3
22 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
This site not encourages mail exchange. Post your forms code here and any references used in your project.
0
 

Author Comment

by:svpam
Comment Utility
Well look, thats fine, I can do it but I have a number of check boxes, text boxes and control arrays...
0
 
LVL 1

Expert Comment

by:slavikn
Comment Utility
slava_site@hotmail.com
(I must give my e-mail, sorry).
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
You could paste plain text forms, just open them with notepad and paste here (if you want).
The matter with emails is that problem should be solved in the forum, so others can help/learn too, not with a private solution.
besides, when more people works on the same problem, the possibilities of found a solution grows up.
0
 

Author Comment

by:svpam
Comment Utility
How do you do that?
0
 
LVL 3

Expert Comment

by:nzjonboy
Comment Utility
open the .frm files (and any other fiels in your project) with notepad, just open notepad and drag them on. You should be able to see a breakdown of the form objects and the underlying code.

nzjonboy
0
 

Author Comment

by:svpam
Comment Utility
frmMain:
VERSION 5.00
Begin VB.Form frmMain
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Williams Lumber - Orders"
   ClientHeight    =   6900
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8430
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6900
   ScaleWidth      =   8430
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdExit
      Caption         =   "E&xit"
      Height          =   615
      Left            =   5040
      TabIndex        =   44
      Top             =   6120
      Width           =   3255
   End
   Begin VB.CommandButton cmdNewOrder
      Caption         =   "&New Order"
      Height          =   615
      Left            =   5040
      TabIndex        =   43
      Top             =   5040
      Width           =   3255
   End
   Begin VB.CommandButton cmdTotal
      Caption         =   "&Total Order"
      Height          =   615
      Left            =   5040
      TabIndex        =   42
      Top             =   3960
      Width           =   3255
   End
   Begin VB.Frame Frame6
      Caption         =   "Purchase Information:"
      Height          =   2895
      Left            =   120
      TabIndex        =   26
      Top             =   3840
      Width           =   4695
      Begin VB.Label lblTotal
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   2880
         TabIndex        =   41
         Top             =   2520
         Width           =   1335
      End
      Begin VB.Label lblDelivery
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   2880
         TabIndex        =   40
         Top             =   2160
         Width           =   1335
      End
      Begin VB.Label Label14
         AutoSize        =   -1  'True
         Caption         =   "Order Total:"
         Height          =   195
         Left            =   1320
         TabIndex        =   39
         Top             =   2520
         Width           =   840
      End
      Begin VB.Label Label13
         AutoSize        =   -1  'True
         Caption         =   "Delivery Total:"
         Height          =   195
         Left            =   1200
         TabIndex        =   38
         Top             =   2160
         Width           =   1020
      End
      Begin VB.Label lbl2x8Cost
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   2880
         TabIndex        =   37
         Top             =   1680
         Width           =   1305
      End
      Begin VB.Label lbl2x6Cost
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   2880
         TabIndex        =   36
         Top             =   1200
         Width           =   1305
      End
      Begin VB.Label lbl2x4Cost
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   2880
         TabIndex        =   35
         Top             =   720
         Width           =   1305
      End
      Begin VB.Label lbl2x8TotalFeet
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   1440
         TabIndex        =   34
         Top             =   1680
         Width           =   1305
      End
      Begin VB.Label lbl2x6TotalFeet
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   1440
         TabIndex        =   33
         Top             =   1200
         Width           =   1305
      End
      Begin VB.Label lbl2x4TotalFeet
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   1440
         TabIndex        =   32
         Top             =   720
         Width           =   1305
      End
      Begin VB.Label Label6
         AutoSize        =   -1  'True
         Caption         =   "Total Cost:"
         Height          =   195
         Left            =   3120
         TabIndex        =   31
         Top             =   360
         Width           =   765
      End
      Begin VB.Label Label5
         AutoSize        =   -1  'True
         Caption         =   "Total Feet:"
         Height          =   195
         Left            =   1680
         TabIndex        =   30
         Top             =   360
         Width           =   765
      End
      Begin VB.Label Label4
         AutoSize        =   -1  'True
         Caption         =   "2 x 8"
         Height          =   195
         Left            =   480
         TabIndex        =   29
         Top             =   1680
         Width           =   345
      End
      Begin VB.Label Label3
         AutoSize        =   -1  'True
         Caption         =   "2 x 6"
         Height          =   195
         Left            =   480
         TabIndex        =   28
         Top             =   1200
         Width           =   345
      End
      Begin VB.Label Label2
         AutoSize        =   -1  'True
         Caption         =   "2 x 4"
         Height          =   195
         Left            =   480
         TabIndex        =   27
         Top             =   720
         Width           =   345
      End
   End
   Begin VB.Frame Frame1
      Caption         =   "Customer Information:"
      Height          =   3375
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   8175
      Begin VB.CheckBox chkFixSize
         Caption         =   "2 x 8"
         Height          =   195
         Index           =   2
         Left            =   180
         TabIndex        =   56
         Top             =   2110
         Width           =   735
      End
      Begin VB.CheckBox chkFixSize
         Caption         =   "2 x 6"
         Height          =   195
         Index           =   1
         Left            =   180
         TabIndex        =   55
         Top             =   1500
         Width           =   735
      End
      Begin VB.CheckBox chkFixSize
         Caption         =   "2 x 4"
         Height          =   195
         Index           =   0
         Left            =   180
         TabIndex        =   54
         Top             =   920
         Width           =   735
      End
      Begin VB.Frame Frame5
         Height          =   615
         Left            =   120
         TabIndex        =   21
         Top             =   2520
         Width           =   7815
         Begin VB.OptionButton optDelivery
            Caption         =   "Delivery Area 4"
            Height          =   195
            Index           =   3
            Left            =   6240
            TabIndex        =   25
            Top             =   240
            Width           =   1380
         End
         Begin VB.OptionButton optDelivery
            Caption         =   "Delivery Area 3"
            Height          =   195
            Index           =   2
            Left            =   4080
            TabIndex        =   24
            Top             =   240
            Width           =   1380
         End
         Begin VB.OptionButton optDelivery
            Caption         =   "Delivery Area 2"
            Height          =   195
            Index           =   1
            Left            =   2040
            TabIndex        =   23
            Top             =   240
            Width           =   1380
         End
         Begin VB.OptionButton optDelivery
            Caption         =   "Delivery Area 1"
            Height          =   195
            Index           =   0
            Left            =   120
            TabIndex        =   22
            Top             =   240
            Width           =   1380
         End
      End
      Begin VB.Frame fra2x8
         Enabled         =   0   'False
         Height          =   495
         Left            =   960
         TabIndex        =   10
         Top             =   1920
         Width           =   6975
         Begin VB.TextBox txt8Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   3
            Left            =   6120
            TabIndex        =   53
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt8Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   2
            Left            =   4440
            TabIndex        =   52
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt8Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   1
            Left            =   2760
            TabIndex        =   51
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt8Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   0
            Left            =   1080
            TabIndex        =   20
            Top             =   145
            Width           =   615
         End
         Begin VB.CheckBox chk2x8Len
            Caption         =   "14 Feet"
            Height          =   195
            Index           =   3
            Left            =   5160
            TabIndex        =   19
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x8Len
            Caption         =   "12 Feet"
            Height          =   195
            Index           =   2
            Left            =   3480
            TabIndex        =   18
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x8Len
            Caption         =   "10 Feet"
            Height          =   195
            Index           =   1
            Left            =   1800
            TabIndex        =   17
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x8Len
            Caption         =   "8 Feet"
            Height          =   195
            Index           =   0
            Left            =   240
            TabIndex        =   16
            Top             =   200
            Width           =   855
         End
      End
      Begin VB.Frame fra2x6
         Enabled         =   0   'False
         Height          =   495
         Left            =   960
         TabIndex        =   9
         Top             =   1320
         Width           =   6975
         Begin VB.TextBox txt6Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   3
            Left            =   6120
            TabIndex        =   50
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt6Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   2
            Left            =   4440
            TabIndex        =   49
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt6Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   1
            Left            =   2760
            TabIndex        =   48
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt6Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   0
            Left            =   1080
            TabIndex        =   15
            Top             =   145
            Width           =   615
         End
         Begin VB.CheckBox chk2x6Len
            Caption         =   "14 Feet"
            Height          =   195
            Index           =   3
            Left            =   5160
            TabIndex        =   14
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x6Len
            Caption         =   "12 Feet"
            Height          =   195
            Index           =   2
            Left            =   3480
            TabIndex        =   13
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x6Len
            Caption         =   "10 Feet"
            Height          =   195
            Index           =   1
            Left            =   1800
            TabIndex        =   12
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x6Len
            Caption         =   "8 Feet"
            Height          =   195
            Index           =   0
            Left            =   240
            TabIndex        =   11
            Top             =   200
            Width           =   855
         End
      End
      Begin VB.Frame fra2x4
         Enabled         =   0   'False
         Height          =   495
         Left            =   960
         TabIndex        =   3
         Top             =   720
         Width           =   6975
         Begin VB.TextBox txt4Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   3
            Left            =   6120
            TabIndex        =   47
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt4Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   2
            Left            =   4440
            TabIndex        =   46
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt4Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            Enabled         =   0   'False
            Height          =   285
            Index           =   1
            Left            =   2760
            TabIndex        =   45
            Top             =   145
            Width           =   615
         End
         Begin VB.TextBox txt4Amount
            Alignment       =   2  'Center
            Appearance      =   0  'Flat
            BackColor       =   &H8000000B&
            BeginProperty DataFormat
               Type            =   0
               Format          =   "0;(0)"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   3081
               SubFormatType   =   0
            EndProperty
            Enabled         =   0   'False
            Height          =   285
            Index           =   0
            Left            =   1080
            TabIndex        =   8
            Top             =   145
            Width           =   615
         End
         Begin VB.CheckBox chk2x4Len
            Caption         =   "14 Feet"
            Height          =   195
            Index           =   3
            Left            =   5160
            TabIndex        =   7
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x4Len
            Caption         =   "12 Feet"
            Height          =   195
            Index           =   2
            Left            =   3480
            TabIndex        =   6
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x4Len
            Caption         =   "10 Feet"
            Height          =   195
            Index           =   1
            Left            =   1800
            TabIndex        =   5
            Top             =   200
            Width           =   855
         End
         Begin VB.CheckBox chk2x4Len
            Caption         =   "8 Feet"
            Height          =   195
            Index           =   0
            Left            =   240
            TabIndex        =   4
            Top             =   200
            Width           =   855
         End
      End
      Begin VB.TextBox Text1
         Appearance      =   0  'Flat
         Height          =   285
         Left            =   1440
         TabIndex        =   2
         Top             =   280
         Width           =   2175
      End
      Begin VB.Label Label1
         AutoSize        =   -1  'True
         Caption         =   "Customer Name:"
         Height          =   195
         Left            =   150
         TabIndex        =   1
         Top             =   330
         Width           =   1170
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public mintDelOpt As Integer
Public mintchk4Index As Integer

Public mintIndex As Integer

Public mstrControlName As String
Public mstrTextBoxName As String

Private Sub chk2x4Len_Click(Index As Integer)
mintIndex = Index
mstrControlName = chk2x4Len_Click
mstrTextBoxName = txt4Amount
CheckBoxChange
End Sub

Private Sub chk2x6Len_Click(Index As Integer)
' *********************************************
'   Disable / Enable Check Boxes - Code Start:
Select Case chk2x6Len.Item(Index).Value
    Case vbChecked
        txt6Amount(Index).Enabled = True
        txt6Amount(Index).BackColor = &H80000005
    Case vbUnchecked
        txt6Amount(Index).Enabled = False
        txt6Amount(Index).BackColor = &H8000000B
        txt6Amount(Index).Text = vbNullString
End Select
'   Disable / Enable Check Boxes - Code End:
' *********************************************
Select Case (Index)
    Case 0
    mint2x6_8 = "0"
    Case 1
    mint2x6_10 = "0"
    Case 2
    mint2x6_12 = "0"
    Case 3
    mint2x6_14 = "0"
End Select
End Sub

Private Sub chk2x8Len_Click(Index As Integer)
' *********************************************
'   Disable / Enable Check Boxes - Code Start:
Select Case chk2x8Len.Item(Index).Value
    Case vbChecked
        txt8Amount(Index).Enabled = True
        txt8Amount(Index).BackColor = &H80000005
    Case vbUnchecked
        txt8Amount(Index).Enabled = False
        txt8Amount(Index).BackColor = &H8000000B
        txt8Amount(Index).Text = vbNullString
End Select
'   Disable / Enable Check Boxes - Code End:
' *********************************************
Select Case (Index)
    Case 0
    mint2x8_8 = "0"
    Case 1
    mint2x8_10 = "0"
    Case 2
    mint2x8_12 = "0"
    Case 3
    mint2x8_14 = "0"
End Select
End Sub

Private Sub chkFixSize_Click(Index As Integer)
Select Case (Index)
    Case 0
    If chkFixSize.Item(Index).Value = vbChecked Then
        fra2x4.Enabled = True
    Else
        fra2x4.Enabled = False
        chk2x4Len.Item(0).Value = vbUnchecked
        chk2x4Len.Item(1).Value = vbUnchecked
        chk2x4Len.Item(2).Value = vbUnchecked
        chk2x4Len.Item(3).Value = vbUnchecked
        txt4Amount(Index).Text = vbNullString
    End If
   
    Case 1
    If chkFixSize.Item(Index).Value = vbChecked Then
        fra2x6.Enabled = True
    Else
        fra2x6.Enabled = False
        chk2x6Len.Item(0).Value = vbUnchecked
        chk2x6Len.Item(1).Value = vbUnchecked
        chk2x6Len.Item(2).Value = vbUnchecked
        chk2x6Len.Item(3).Value = vbUnchecked
        txt6Amount(Index).Text = vbNullString
    End If
   
    Case 2
    If chkFixSize.Item(Index).Value = vbChecked Then
        fra2x8.Enabled = True
    Else
        fra2x8.Enabled = False
        chk2x8Len.Item(0).Value = vbUnchecked
        chk2x8Len.Item(1).Value = vbUnchecked
        chk2x8Len.Item(2).Value = vbUnchecked
        chk2x8Len.Item(3).Value = vbUnchecked
        txt8Amount(Index).Text = vbNullString
    End If
   
End Select
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdTotal_Click()
' *****************************
'
' Work Out Cost For 2x6 Lumber:


    pint2x4 = cintFeet8 * mint2x4_8 + cintFeet10 * mint2x4_10 + cintFeet12 * mint2x4_12 + cintFeet14 * mint2x4_14
    lbl2x4TotalFeet.Caption = pint2x4
   
    psng2x4Cost = pint2x4 * csngCost2x4
    lbl2x4Cost.Caption = Format(psng2x4Cost, "Fixed")
' *****************************

    pint2x6 = cintFeet8 * mint2x6_8 + cintFeet10 * mint2x6_10 + cintFeet12 * mint2x6_12 + cintFeet14 * mint2x6_14
    lbl2x6TotalFeet.Caption = pint2x6
   
    psng2x6Cost = pint2x6 * csngCost2x6
    lbl2x6Cost.Caption = Format(psng2x6Cost, "Fixed")

    pint2x8 = cintFeet8 * mint2x8_8 + cintFeet10 * mint2x8_10 + cintFeet12 * mint2x8_12 + cintFeet14 * mint2x8_14
    lbl2x8TotalFeet.Caption = pint2x8
   
    psng2x8Cost = pint2x8 * csngCost2x8
    lbl2x8Cost.Caption = Format(psng2x8Cost, "Fixed")
   
Dim psngTotalCost As Single
Dim pintDeliveryTotal As Integer
Dim pintTotalFeet As Integer
Dim pintDeliveryOption As Integer

    pintTotalFeet = pint2x6 + pint2x6 + pint2x8

Select Case pintTotalFeet
       
        Case "1" To "699"
        pintDeliveryTotal = cintFeetCharge1
       ' lblDelivery.Caption = pintDeliveryTotal
       
        Case "500" To "999"
        pintDeliveryTotal = cintFeetCharge2
       ' lblDelivery.Caption = pintDeliveryTotal
           
        Case "1000" To "2000"
        pintDeliveryTotal = cintFeetCharge3
        'lblDelivery.Caption = pintDeliveryTotal
       
        Case Is > "2000"
        pintDeliveryTotal = cintFeetCharge4
        'lblDelivery.Caption = pintDeliveryTotal
       
        Case Else
       ' lblDelivery.Caption = pintDeliveryTotal

End Select
   
If mintDelOpt = 1 Then
pintDeliveryTotal = pintDeliveryTotal + cintDelivery1
ElseIf mintDelOpt = 2 Then
pintDeliveryTotal = pintDeliveryTotal + cintDelivery2
ElseIf mintDelOpt = 3 Then
pintDeliveryTotal = pintDeliveryTotal + cintDelivery3
ElseIf mintDelOpt = 6 Then
pintDeliveryTotal = pintDeliveryTotal + cintDelivery4
End If
    psngTotalCost = psng2x6Cost + psng2x6Cost + psng2x8Cost + pintDeliveryTotal
    lblTotal.Caption = Format(psngTotalCost, "Currency")
    lblDelivery.Caption = pintDeliveryTotal
End Sub

Private Sub optDelivery_Click(Index As Integer)
Select Case Index
        Case 0  ' Zone 1
            mintDelOpt = 1
        Case 1 ' Zone 2
            mintDelOpt = 2
        Case 2 ' Zone 3
            mintDelOpt = 3
        Case 3 ' Eat In
            mintDelOpt = 6
End Select
End Sub

Private Sub txt4Amount_Change(Index As Integer)
On Error GoTo ErrorSub
    Select Case Index
        Case 0  ' Zone 1
            mint2x4_8 = txt4Amount(0)
        Case 1 ' Zone 2
            mint2x4_10 = txt4Amount(1)
        Case 2 ' Zone 3
            mint2x4_12 = txt4Amount(2)
        Case 3 ' Eat In
            mint2x4_14 = txt4Amount(3)
    End Select
    Exit Sub
ErrorSub:
End Sub

Private Sub txt6Amount_Change(Index As Integer)
On Error GoTo ErrorSub
    Select Case Index
        Case 0  ' Zone 1
            mint2x6_8 = txt6Amount(0)
        Case 1 ' Zone 2
            mint2x6_10 = txt6Amount(1)
        Case 2 ' Zone 3
            mint2x6_12 = txt6Amount(2)
        Case 3 ' Eat In
            mint2x6_14 = txt6Amount(3)
    End Select
    Exit Sub
ErrorSub:
End Sub

Private Sub txt8Amount_Change(Index As Integer)
On Error GoTo ErrorSub
    Select Case Index
        Case 0  ' Zone 1
            mint2x8_8 = txt8Amount(0)
        Case 1 ' Zone 2
            mint2x8_10 = txt8Amount(1)
        Case 2 ' Zone 3
            mint2x8_12 = txt8Amount(2)
        Case 3 ' Eat In
            mint2x8_14 = txt8Amount(3)
    End Select
    Exit Sub
ErrorSub:
End Sub










Public Sub chk4Change()
' *********************************************
'   Disable / Enable Check Boxes - Code Start:
Select Case mstrControlName.Item(mintIndex).Value
    Case vbChecked
        txt4Amount(mintchk4Index).Enabled = True
        txt4Amount(mintchk4Index).BackColor = &H80000005
    Case vbUnchecked
        txt4Amount(mintchk4Index).Enabled = False
        txt4Amount(mintchk4Index).BackColor = &H8000000B
        txt4Amount(mintchk4Index).Text = vbNullString
End Select
'   Disable / Enable Check Boxes - Code End:
' *********************************************
Select Case (mintchk4Index)
    Case 0
    mint2x4_8 = "0"
    Case 1
    mint2x4_10 = "0"
    Case 2
    mint2x4_12 = "0"
    Case 3
    mint2x4_14 = "0"
End Select





End Sub



Public Sub CheckBoxChange()
Select Case mstrControlName.Item(mintIndex).Value
    Case vbChecked
        mstrTextBoxName(mintIndex).Enabled = True
        mstrTextBoxName(mintIndex).BackColor = &H80000005
    Case vbUnchecked
        mstrTextBoxName(mintIndex).Enabled = False
        mstrTextBoxName(mintIndex).BackColor = &H8000000B
        mstrTextBoxName(mintIndex).Text = vbNullString
End Select
End Sub




modGeneral:


Attribute VB_Name = "modGeneral"
Option Explicit

Public Const cintFeet8 As Integer = 8
Public Const cintFeet10 As Integer = 10
Public Const cintFeet12 As Integer = 12
Public Const cintFeet14 As Integer = 14

Public Const csngCost2x4 As Single = 0.16
Public Const csngCost2x6 As Single = 0.22
Public Const csngCost2x8 As Single = 0.31

Public Const cintDelivery1 As Integer = 10
Public Const cintDelivery2 As Integer = 20
Public Const cintDelivery3 As Integer = 30
Public Const cintDelivery4 As Integer = 40

' Delivery Information:
Public Const cintFeetCharge1 As Integer = 10
Public Const cintFeetCharge2 As Integer = 20
Public Const cintFeetCharge3 As Integer = 30
Public Const cintFeetCharge4 As Integer = 40



' Code For 2x4 Lengths Start:

Public mint2x4_8 As Integer
Public mint2x4_10 As Integer
Public mint2x4_12 As Integer
Public mint2x4_14 As Integer

' Code For 2x4 Lengths End

' Code For 2x6 Lengths Start:

Public mint2x6_8 As Integer
Public mint2x6_10 As Integer
Public mint2x6_12 As Integer
Public mint2x6_14 As Integer

' Code For 2x6 Lengths End

' Code For 2x8 Lengths Start:

Public mint2x8_8 As Integer
Public mint2x8_10 As Integer
Public mint2x8_12 As Integer
Public mint2x8_14 As Integer

' Code For 2x8 Lengths End



Public mint2x4 As Integer
Public mint2x6 As Integer
Public mint2x8 As Integer

Public pint2x4 As Integer
Public psng2x4Cost As Single

Public pint2x6 As Integer
Public psng2x6Cost As Single

Public pint2x8 As Integer
Public psng2x8Cost As Single







Basically : I want someone to change any code you feel is bad. Also I do need help with the new order button.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
At first sight, you are asigning control names to strings but without quotes.
You are using string variables like objects!
0
 

Author Comment

by:svpam
Comment Utility
And this means...
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
... if you need to access control's properties of frmMain from outside it, the reference should be something like this:

frmMain.text1(mintIndex).enabled = true ' or false
or
frmmain.controls("text1").text = "change" ' or whatever
This last one is not so good since vb has to search in controls collection until find a control named "text1" and you cannot use with a control array.
If you need to use in a control array, you have to dem a variable of type Object,iterate throught controls collection, locate it and asign a property value.
With too much controls, it will be too much expensive.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
give this a shoot:

Public Sub CheckBoxChange()
With frmMain.Controls(mstrTextBoxName).Item(mintIndex)
    Select Case frmMain.Controls(mstrControlName).Item(mintIndex).Value
       Case vbChecked
           .Enabled = True
           .BackColor = &H80000005
       Case vbUnchecked
           .Enabled = False
           .BackColor = &H8000000B
           .Text = vbNullString
    End Select
End With
End Sub

Public Sub chk4Change()
' *********************************************
'   Disable / Enable Check Boxes - Code Start:
With frmMain.txt4Amount(mintchk4Index)
    Select Case mstrControlName.Item(mintIndex).Value
       Case vbChecked
           .Enabled = True
           .BackColor = &H80000005
       Case vbUnchecked
           .Enabled = False
           .BackColor = &H8000000B
           .Text = vbNullString
    End Select
End With
'   Disable / Enable Check Boxes - Code End:
' *********************************************
Select Case (mintchk4Index)
   Case 0
   mint2x4_8 = "0"
   Case 1
   mint2x4_10 = "0"
   Case 2
   mint2x4_12 = "0"
   Case 3
   mint2x4_14 = "0"
End Select

End Sub
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:slavikn
Comment Utility
To clear all your text field use this code:

Private Sub Command1_Click()
   Dim MyControl As Control
 
   For Each MyControl In Controls
      If TypeOf MyControl Is TextBox Then
         MyControl.Text = ""
      End If
   Next
End Sub
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
that's it! I did try to avoid that for each loop since it has its cost in a form with so many controls.
0
 

Author Comment

by:svpam
Comment Utility
For that to work Richie (which does look good I must say) I think their is a problem here :

Private Sub chk2x4Len_Click(Index As Integer)
mintIndex = Index
mstrControlName = chk2x4Len
mstrTextBoxName = txt4Amount
CheckBoxChange
End Sub


It cant pick up the name of the control....
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
oops! sorry i did the necessary changes in my code but i didn't post them:

Private Sub chk2x4Len_Click(Index As Integer)
mintIndex = Index
mstrControlName = "chk2x4Len"
mstrTextBoxName = "txt4Amount"
CheckBoxChange
End Sub
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
By the way, i must to admit that form's layout is excellent. I don't know for what app is created but has a nice look.
0
 

Author Comment

by:svpam
Comment Utility
LOL ! Thanks - Im not to bad when it comes to the GUI, doing the code can be another story !


Look Im still getting a few different errors : I think it would be best if you just posted your code to save us here. For some reason it is still having problems with picking up the controls.

If you want you can Email it : watcher01@start.com.au
0
 

Author Comment

by:svpam
Comment Utility
Just a few things - Does this do anything or something I should delete : Just couldnt find anything linking to it just quickly :

Public Sub chk4Change()
' *********************************************
'   Disable / Enable Check Boxes - Code Start:
With frmMain.txt4Amount(mintchk4Index)
    Select Case mstrControlName.Item(mintIndex).Value
       Case vbChecked
           .Enabled = True
           .BackColor = &H80000005
       Case vbUnchecked
           .Enabled = False
           .BackColor = &H8000000B
           .Text = vbNullString
    End Select
End With
'   Disable / Enable Check Boxes - Code End:
' *********************************************
End Sub


Also, how can I wipe the form really quick when I hit the New Order button ? Any ideas?

PS - Will change points for your effort...
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
First part: i really don't know. I just did correct some misconceptions regarding objects variables and their usage. That sub was wrote by you, i only did correct it.
Second Part: let me see....
0
 

Author Comment

by:svpam
Comment Utility
OK - Hope you can work something out... Sorry for the late response...
0
 
LVL 16

Expert Comment

by:twalgrave
Comment Utility
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- PAQ/no refund
Please leave any comments here within the
next seven days.
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now