Question 19 errors after converting from VB6

ashtashooter

New member
Joined
Dec 29, 2010
Messages
2
Programming Experience
Beginner
Hi all,

Instead of rewriting the whole code from scratch in VB.Net, I chose to use the upgrade facility MS Visual Studio provides.
Now I'm having trouble fixing all the resultant errors, so I hope someone can help me with that.

Thank you

Here is the code:

VB.NET:
[FONT="Courier New"][SIZE="3"]Option Strict Off
Option Explicit On
'UPGRADE_NOTE: Main was upgraded to Main_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
Friend Class Main_Renamed
	Inherits System.Windows.Forms.Form
	Private Sub cmdQuit_Click()
		End
	End Sub
	
    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
        frmCustomers.Show()
    End Sub

    Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
        frmDeposits.Show()
    End Sub

    Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click
        frmWithdrawal.Show()
    End Sub

    Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
        frmTransactions.Show()
    End Sub

    Private Sub Command5_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command5.Click
        frmAccTypes.Show()
    End Sub

    Private Sub Command6_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command6.Click
        Dim rptWithdrawals As Object

        'UPGRADE_WARNING: Couldn't resolve default property of object rptWithdrawals.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        'UPGRADE_NOTE: Object rptWithdrawals.DataSource may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
        rptWithdrawals.DataSource = Nothing
        'UPGRADE_WARNING: Couldn't resolve default property of object rptWithdrawals.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        rptWithdrawals.DataSource = rsWithdrawal
        'UPGRADE_WARNING: Couldn't resolve default property of object rptWithdrawals.Show. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        rptWithdrawals.Show()
    End Sub

    Private Sub Command7_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command7.Click
        End

    End Sub

    Private Sub Command8_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command8.Click
        About.Show()

    End Sub

    Private Sub Main_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Call connectDatabase()
    End Sub

    Private Sub Toolbar1_ButtonClick(ByVal Button As System.Windows.Forms.ToolStripButton)
        Select Case Button.Owner.Items.IndexOf(Button)
            Case 1
                frmCustomers.Show()
            Case 4
                frmDeposits.Show()
            Case 7
                frmWithdrawal.Show()
            Case 10
                frmTransactions.Show()
        End Select
    End Sub

    Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As System.Windows.Forms.ToolStripMenuItem)
        Dim rptWithdrawals As Object
        Dim rptDeposits As Object
        Dim rptCustomers As Object
        'UPGRADE_ISSUE: MSComctlLib.ButtonMenu property ButtonMenu.Key was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
        Select Case ButtonMenu.Key
            Case "acc_type"
                frmAccTypes.Show()

            Case "customer"
                'UPGRADE_WARNING: Couldn't resolve default property of object rptCustomers.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_NOTE: Object rptCustomers.DataSource may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
                rptCustomers.DataSource = Nothing
                'UPGRADE_WARNING: Couldn't resolve default property of object rptCustomers.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                rptCustomers.DataSource = rsCustomers
                'UPGRADE_WARNING: Couldn't resolve default property of object rptCustomers.Show. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                rptCustomers.Show()

            Case "deposit"
                'UPGRADE_WARNING: Couldn't resolve default property of object rptDeposits.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_NOTE: Object rptDeposits.DataSource may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
                rptDeposits.DataSource = Nothing
                'UPGRADE_WARNING: Couldn't resolve default property of object rptDeposits.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                rptDeposits.DataSource = rsDeposit
                'UPGRADE_WARNING: Couldn't resolve default property of object rptDeposits.Show. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                rptDeposits.Show()

            Case "withdraw"
                'UPGRADE_WARNING: Couldn't resolve default property of object rptWithdrawals.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_NOTE: Object rptWithdrawals.DataSource may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
                rptWithdrawals.DataSource = Nothing
                'UPGRADE_WARNING: Couldn't resolve default property of object rptWithdrawals.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                rptWithdrawals.DataSource = rsWithdrawal
                'UPGRADE_WARNING: Couldn't resolve default property of object rptWithdrawals.Show. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                rptWithdrawals.Show()


        End Select
    End Sub
End Class[/FONT][/SIZE]

And:

VB.NET:
[FONT="Courier New"][SIZE="3"]Option Strict Off
Option Explicit On
Module Mdl
	
	
	Public cnBank As ADODB.Connection
	Public rsCustomers As ADODB.Recordset
	Public rsDeposit As ADODB.Recordset
	Public rsWithdrawal As ADODB.Recordset
	Public rsTransactions As ADODB.Recordset
	Public rsAccTypes As ADODB.Recordset
	Public rsBalances As ADODB.Recordset
	Public rsTemp As ADODB.Recordset
	
	Public X As Short
	Public NewRecord As Boolean
	
	Public Sub connectDatabase()
		
		cnBank = New ADODB.Connection
		With cnBank
			.Provider = "Microsoft.JET.OLEDB.4.0"
			.ConnectionString = My.Application.Info.DirectoryPath & "\dbBank.mdb"
			.Open()
		End With
		
		rsCustomers = New ADODB.Recordset
		rsCustomers.Open("tblCustomers", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		
		rsDeposit = New ADODB.Recordset
		rsDeposit.Open("tblDeposits", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		
		rsWithdrawal = New ADODB.Recordset
		rsWithdrawal.Open("tblWithdrawals", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		
		rsBalances = New ADODB.Recordset
		rsBalances.Open("tblBalances", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		
		rsTransactions = New ADODB.Recordset
		rsTransactions.Open("tblTransactions", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		
		rsAccTypes = New ADODB.Recordset
		rsAccTypes.Open("tblAccTypes", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		
	End Sub
	Public Sub clear_Form_Controls(ByRef frm As System.Windows.Forms.Form)
		Dim ctrl As System.Windows.Forms.Control
		For	Each ctrl In frm.Controls
			'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			If TypeOf ctrl Is System.Windows.Forms.TextBox Then
				ctrl.Text = ""
				'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			ElseIf TypeOf ctrl Is System.Windows.Forms.ComboBox Then 
				ctrl.Text = ""
				'        ElseIf TypeOf ctrl Is MaskEdBox Then
				'            ctrl.Text = ""
			Else
				'        frm.Refresh
			End If
		Next ctrl
	End Sub
	
	Public Sub Lock_Form_Controls(ByRef frm As System.Windows.Forms.Form)
		Dim ctrl As System.Windows.Forms.Control
		For	Each ctrl In frm.Controls
			'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			If TypeOf ctrl Is System.Windows.Forms.TextBox Then
				'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Locked. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ctrl.Locked = True
				'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			ElseIf TypeOf ctrl Is System.Windows.Forms.ComboBox Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Locked. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ctrl.Locked = True
				'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			ElseIf TypeOf ctrl Is System.Windows.Forms.MaskedTextBox Then 
				ctrl.Enabled = True
			End If
		Next ctrl
	End Sub
	Public Sub UnLock_Form_Controls(ByRef frm As System.Windows.Forms.Form)
		Dim ctrl As System.Windows.Forms.Control
		For	Each ctrl In frm.Controls
			'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			If TypeOf ctrl Is System.Windows.Forms.TextBox Then
				'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Locked. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ctrl.Locked = False
				'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			ElseIf TypeOf ctrl Is System.Windows.Forms.ComboBox Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object ctrl.Locked. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ctrl.Locked = False
				'UPGRADE_WARNING: TypeOf has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			ElseIf TypeOf ctrl Is System.Windows.Forms.MaskedTextBox Then 
				ctrl.Enabled = True
			End If
		Next ctrl
	End Sub
	
	Public Sub disconnectDatabase()
		cnBank.Close()
	End Sub
	Public Sub selectTextControl(ByRef txtCtrl As System.Windows.Forms.TextBox)
		txtCtrl.SelectionStart = 0
		txtCtrl.SelectionLength = Len(txtCtrl.Text)
	End Sub
	
	Public Sub selectMaskControl(ByRef maskCtrl As System.Windows.Forms.MaskedTextBox)
		maskCtrl.SelectionStart = 0
		maskCtrl.SelectionLength = Len(maskCtrl.Text)
	End Sub
	Public Sub ValidNonNumeric(ByRef KeyAscii As Short)
		KeyAscii = Asc(UCase(Chr(KeyAscii)))
		Select Case KeyAscii
			Case Asc(" ")
			Case 65 To 90
			Case 97 To 122
			Case 32
			Case 13
			Case 8
			Case 127
			Case Else
				MsgBox("Invalid Input. Please Don't Enter Numerics...", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation)
				KeyAscii = 0
		End Select
	End Sub
	
	Public Sub ValidNumeric(ByRef KeyAscii As Short)
		Select Case KeyAscii
			Case 8
			Case 97
			Case 110
			Case 47
			Case 13
			Case 32
			Case 48 To 57
			Case Else
				MsgBox("Invalid Input.Please Enter Numeric Types Only..", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation)
				KeyAscii = 0
		End Select
	End Sub
	
	Public Sub CheckDatabaseStatus(ByRef rsStat As ADODB.Recordset)
		With rsStat
			If .BOF = True And .EOF = True Then
				MsgBox("There are currently No records Available for this module", MsgBoxStyle.Information)
				Exit Sub
			End If
		End With
	End Sub
	Public Sub MoveToFirst(ByRef rsFirst As ADODB.Recordset)
		With rsFirst
			Call CheckDatabaseStatus(rsFirst)
			.MoveFirst()
			If .BOF Then
				.MoveFirst()
				MsgBox("This is the first Record..", MsgBoxStyle.Information)
				Exit Sub
			End If
		End With
	End Sub
	Public Sub MoveToPrev(ByRef rsPrev As ADODB.Recordset)
		With rsPrev
			Call CheckDatabaseStatus(rsPrev)
			.MovePrevious()
			If .BOF Then
				.MoveFirst()
				MsgBox("This is the first Record..", MsgBoxStyle.Information)
				Exit Sub
			End If
			
		End With
		
	End Sub
	Public Sub MoveToNext(ByRef rsNext As ADODB.Recordset)
		With rsNext
			Call CheckDatabaseStatus(rsNext)
			.MoveNext()
			If .EOF Then
				.MoveLast()
				MsgBox("This is the last Record..", MsgBoxStyle.Information)
				Exit Sub
			End If
		End With
	End Sub
	
	Public Sub MoveToLast(ByRef rsLast As ADODB.Recordset)
		With rsLast
			Call CheckDatabaseStatus(rsLast)
			.MoveLast()
			If .EOF Then
				.MoveLast()
				MsgBox("This is the last Record..", MsgBoxStyle.Information)
				Exit Sub
			End If
		End With
	End Sub
	
	Public Sub Messager()
		MsgBox("Please Ensure that all fields are Complete", MsgBoxStyle.Exclamation)
	End Sub
End Module[/SIZE][/FONT]

Also:

VB.NET:
[FONT="Courier New"][SIZE="3"]Option Strict Off
Option Explicit On
Friend Class frmTransaction
	Inherits System.Windows.Forms.Form
	Private Sub cmdClose_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdClose.Click
		Me.Close()
	End Sub
	
	Private Sub cmdSave_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSave.Click
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * FROM tblTransactions WHERE Code=" & txtCode.Text & " ", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			.Fields("CustomerID").Value = txtCustomerID.Text
			.Fields("AccountNo").Value = txtAccountNo.Text
			.Fields("Narration").Value = txtNarration.Text
			.Fields("CheckNO").Value = txtCheckNo.Text
			'UPGRADE_WARNING: Couldn't resolve default property of object txtDated.Value. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			.Fields("Dated").Value = txtDated.Value
			.Fields("Debit").Value = txtDebit.Text
			.Fields("Mode").Value = txtMode.Text
			.Fields("Credit").Value = txtCredit.Text
			.Fields("Balance").Value = txtBalance.Text
			.Update()
		End With
		rsTemp.Close()
		rsTransactions.Requery()
		frmTransactions.lvwTransactions.Refresh()
		Me.Close()
	End Sub
	
	Private Sub frmTransaction_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Call connectDatabase()
	End Sub
	
	Public Sub DisplayTransact(ByRef myRs As ADODB.Recordset)
		Dim txtAmountDeposited As Object
		Dim cboCustomerNo As Object
		
		With myRs
			'UPGRADE_WARNING: Couldn't resolve default property of object cboCustomerNo.Text. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			cboCustomerNo.Text = .Fields("CustomerID").Value
			txtAccountNo.Text = .Fields("AccountNo").Value
			txtNarration.Text = .Fields("Narration").Value
			txtCheckNo.Text = .Fields("CheckNO").Value
			txtDated.Value = .Fields("Dated")
			'UPGRADE_WARNING: Couldn't resolve default property of object txtAmountDeposited.Text. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			txtAmountDeposited.Text = .Fields("Debit").Value
			txtMode.Text = .Fields("Mode").Value
			txtCredit.Text = .Fields("Credit").Value
			txtBalance.Text = .Fields("Balance").Value
		End With
		
	End Sub
	
	Private Sub lblFieldLabel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblFieldLabel.Click
		Dim Index As Short = lblFieldLabel.GetIndex(eventSender)
		
	End Sub
	
	Private Sub txtDated_CallbackKeyDown(ByVal eventSender As System.Object, ByVal eventArgs As AxMSComCtl2.DDTPickerEvents_CallbackKeyDownEvent) Handles txtDated.CallbackKeyDown
		
	End Sub
End Class[/SIZE][/FONT]

And finally:

VB.NET:
[FONT="Courier New"][SIZE="3"]Option Strict Off
Option Explicit On
Friend Class frmTransactions
	Inherits System.Windows.Forms.Form
	Dim lstItem As System.Windows.Forms.ListViewItem
	'UPGRADE_WARNING: Event cboAccNo.SelectedIndexChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub cboAccNo_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cboAccNo.SelectedIndexChanged
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblCustomers Where AccountNo='" & cboAccNo.Text & "'", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				cboAccNo.Text = .Fields("AccountNo").Value
				cboCustomerID.Text = .Fields("CustomerID").Value
				cboFirst.Text = .Fields("FirstName").Value
			Else
				MsgBox("Invalid customer ID/Name/Account NO. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
		
		
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblTransactions Where AccountNo='" & cboAccNo.Text & "'", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				lvwTransactions.Items.Clear()
				Call LoadListView(rsTemp)
				'cboAccNo = !AccountNo
				'cboCustomerID = !CustomerID
				'cboFirst = !FirstName
			Else
				MsgBox("Invalid customer ID/Name/Account NO. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
		
		
	End Sub
	
	'UPGRADE_WARNING: Event cboCustomerID.SelectedIndexChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub cboCustomerID_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cboCustomerID.SelectedIndexChanged
		
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblCustomers Where customerID='" & cboCustomerID.Text & "'", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				cboAccNo.Text = .Fields("AccountNo").Value
				cboCustomerID.Text = .Fields("CustomerID").Value
				cboFirst.Text = .Fields("FirstName").Value
			Else
				MsgBox("Invalid customer ID/Name/Account NO. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
		
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblTransactions Where customerID='" & cboCustomerID.Text & "'", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				lvwTransactions.Items.Clear()
				Call LoadListView(rsTemp)
			Else
				MsgBox("No Transactions bearing this customer ID. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
	End Sub
	
	'UPGRADE_WARNING: Event cboFirst.SelectedIndexChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub cboFirst_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cboFirst.SelectedIndexChanged
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblCustomers Where FirstName='" & cboFirst.Text & "'", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				cboAccNo.Text = .Fields("AccountNo").Value
				cboCustomerID.Text = .Fields("CustomerID").Value
				cboFirst.Text = .Fields("FirstName").Value
			Else
				MsgBox("Invalid customer ID/Name/Account NO. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
		
		
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblTransactions Where CustomerID='" & cboCustomerID.Text & "'", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				lvwTransactions.Items.Clear()
				Call LoadListView(rsTemp)
			Else
				MsgBox("No Transactions bearing this customers' first name. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
	End Sub
	
	Private Sub cmdEdit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdEdit.Click
		With rsTransactions
			.MoveFirst()
			While Not .EOF
				
				'UPGRADE_WARNING: Lower bound of collection lvwTransactions.SelectedItem.ListSubItems has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lvwTransactions.FocusedItem.SubItems.Item(9).Text = .Fields("Code").Value Then
					frmTransaction.txtCustomerID.Text = .Fields("CustomerID").Value
					frmTransaction.txtAccountNo.Text = .Fields("AccountNo").Value
					frmTransaction.txtNarration.Text = .Fields("Narration").Value
					frmTransaction.txtCheckNo.Text = .Fields("CheckNO").Value
					frmTransaction.txtDated.Value = .Fields("Dated")
					frmTransaction.txtDebit.Text = .Fields("Debit").Value
					frmTransaction.txtMode.Text = .Fields("Mode").Value
					frmTransaction.txtCredit.Text = .Fields("Credit").Value
					frmTransaction.txtBalance.Text = .Fields("Balance").Value
					frmTransaction.txtCode.Text = .Fields("Code").Value
					.MoveLast()
					.MoveNext()
				Else
					.MoveNext()
				End If
			End While
			frmTransaction.Show()
		End With
	End Sub
	
	Private Sub cmdOk_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOk.Click
		rsTemp = New ADODB.Recordset
		rsTemp.Open("Select * from tblTransactions Where Dated BETWEEN #" & dtFrom.Value & "# AND #" & dtTo.Value & "#", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
		With rsTemp
			If .RecordCount > 0 Then
				lvwTransactions.Items.Clear()
				Call LoadListView(rsTemp)
			Else
				MsgBox("No Transactions Were carried out between these Dates. Please Try Again", MsgBoxStyle.Information)
				Exit Sub
			End If
			.Close()
		End With
	End Sub
	
	Private Sub cmdPrint_Click()
		Dim rptStatement As Object
		With deBank
			'UPGRADE_WARNING: Couldn't resolve default property of object deBank.rscmdStatement_Grouping.State. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object deBank.rscmdStatement_Grouping.Close. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If .rscmdStatement_Grouping.State = ADODB.ObjectStateEnum.adStateOpen Then .rscmdStatement_Grouping.Close()
			.cmdStatement_Grouping(Val(lvwTransactions.FocusedItem.Text))
			'UPGRADE_WARNING: Couldn't resolve default property of object rptStatement.Show. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			rptStatement.Show()
		End With
		''Dim strSql As String
		'''strSql = "SELECT tblCustomers.FirstName,tblCustomers.LastName,tblCustomers.Address,tblCustomers.PostalCode,tblCustomers.Location,tblCustomers.OpeningBalance,tblCustomers.CustomerID,tblTransactions.AccountNo,tblTransactions.Debit,tblTransactions.Credit,tblTransactions.Dated,tblTransactions.Mode,tblTransactions.CheckNo,tblTransactions.Code from tblCustomers,tblTransactions where tblCustomers.CustomerID=tblTransactions.CustomerID AND tblTransactions.Code=4'" ''& lvwTransactions.SelectedItem.ListSubItems(9).Text & "'"
		''strSql = " SELECT tblCustomers.AccountNo, tblCustomers.Address,"
		''strSql = strSql & "tblCustomers.LastName, tblCustomers.FirstName,"
		''strSql = strSql & "tblCustomers.CustomerID,"
		''strSql = strSql & "tblCustomers.Location, tblCustomers.OpeningBalance, "
		''strSql = strSql & "tblCustomers.PostalCode, tblTransactions.Code, "
		''strSql = strSql & "tblTransactions.CheckNo, tblTransactions.Credit, "
		''strSql = strSql & "tblTransactions.Debit, tblTransactions.Mode "
		''
		''strSql = strSql & "From tblCustomers, tblTransactions "
		''strSql = strSql & "Where tblCustomers.CustomerID = tblTransactions.CustomerID"
		''
		''Set rsTemp = New ADODB.Recordset
		''rsTemp.Open strSql, cnBank, adOpenKeyset, adLockOptimistic
		''With deBank
		'''.Commands("cmdStatement").Parameters = lvwTransactions.SelectedItem.Text
		'''.cmdStatement_Grouping( ,lvwTransactions.SelectedItem.ListSubItems(9))=
		''.Commands("cmdStatement_Grouping").Parameters("tblCustomersCode") = "1"
		''End With
		
		'With rsTemp
		'If .RecordCount > 0 Then
		'Set rptStatement.DataSource = Nothing
		'Set rptStatement.DataSource = rsTemp
		'rptStatement.Show
		'Else
		'MsgBox "few"
		'End If
		'End With
		
	End Sub
	
	Private Sub cmdPrintAll_Click()
		Dim rptStatement As Object
		'UPGRADE_WARNING: Couldn't resolve default property of object rptStatement.Show. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		rptStatement.Show()
	End Sub
	
	Private Sub cmdQuit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdQuit.Click
		Me.Close()
	End Sub
	
	
	Private Sub DTPicker1_Click()
		
	End Sub
	
	Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdRefresh.Click
		lvwTransactions.Refresh()
	End Sub
	
	
	Private Sub Command1_Click()
		
	End Sub
	
	'Text1.Text = lvwTransactions.SelectedItem.Text
	
	
	Private Sub frmTransactions_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		
		Call connectDatabase()
		Call LoadListView(rsTransactions)
		With rsCustomers
			.MoveFirst()
			For X = 1 To .RecordCount
				cboCustomerID.Items.Add(.Fields("CustomerID").Value)
				cboFirst.Items.Add(.Fields("FirstName").Value)
				cboAccNo.Items.Add(.Fields("AccountNo").Value)
				.MoveNext()
			Next X
		End With
		Frame1.Enabled = False
	End Sub
	
	
	Private Sub lvwTransactions_ColumnClick(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.ColumnClickEventArgs) Handles lvwTransactions.ColumnClick
		Dim ColumnHeader As System.Windows.Forms.ColumnHeader = lvwTransactions.Columns(eventArgs.Column)
		' Sort according to data in this column.
		'UPGRADE_ISSUE: MSComctlLib.ListView property lvwTransactions.SortKey was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
		'UPGRADE_ISSUE: MSComctlLib.ListView property lvwTransactions.Sorted was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="076C26E5-B7A9-4E77-B69C-B4448DF39E58"'
		If lvwTransactions.Sorted And ColumnHeader.Index - 1 = lvwTransactions.SortKey Then
			' Already sorted on this column, just invert the sort order.
			lvwTransactions.Sorting = 1 - lvwTransactions.Sorting
		Else
			lvwTransactions.Sorting = System.Windows.Forms.SortOrder.Ascending
			'UPGRADE_ISSUE: MSComctlLib.ListView property lvwTransactions.SortKey was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'
			lvwTransactions.SortKey = ColumnHeader.Index - 1
		End If
		lvwTransactions.Sort()
		
	End Sub
	
	Public Sub LoadListView(ByRef myRs As ADODB.Recordset)
		With myRs
			While Not .EOF
				'lvwTransactions.ListItems.Add , , !CustomerID & " " & !AccountNo ' & " " & !Narration & " " & !Dated & " " & !Debit & " " & !Credit
				lstItem = lvwTransactions.Items.Add(.Fields("CustomerID").Value)
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 1 Then
					lstItem.SubItems(1).Text = .Fields("AccountNo").Value
				Else
					lstItem.SubItems.Insert(1, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("AccountNo").Value))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 2 Then
					lstItem.SubItems(2).Text = .Fields("Narration").Value
				Else
					lstItem.SubItems.Insert(2, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("Narration").Value))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 3 Then
					lstItem.SubItems(3).Text = .Fields("Dated").Value
				Else
					lstItem.SubItems.Insert(3, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("Dated").Value))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 4 Then
					lstItem.SubItems(4).Text = VB6.Format(.Fields("Debit").Value, "#,###,##00.00")
				Else
					lstItem.SubItems.Insert(4, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, VB6.Format(.Fields("Debit").Value, "#,###,##00.00")))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 5 Then
					lstItem.SubItems(5).Text = VB6.Format(.Fields("Credit").Value, "#,###,##00.00")
				Else
					lstItem.SubItems.Insert(5, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, VB6.Format(.Fields("Credit").Value, "#,###,##00.00")))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 6 Then
					lstItem.SubItems(6).Text = .Fields("Mode").Value
				Else
					lstItem.SubItems.Insert(6, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("Mode").Value))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 7 Then
					lstItem.SubItems(7).Text = .Fields("CheckNO").Value
				Else
					lstItem.SubItems.Insert(7, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("CheckNO").Value))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 8 Then
					lstItem.SubItems(8).Text = .Fields("Balance").Value
				Else
					lstItem.SubItems.Insert(8, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("Balance").Value))
				End If
				'UPGRADE_WARNING: Lower bound of collection lstItem has changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A3B628A0-A810-4AE2-BFA2-9E7A29EB9AD0"'
				If lstItem.SubItems.Count > 9 Then
					lstItem.SubItems(9).Text = .Fields("Code").Value
				Else
					lstItem.SubItems.Insert(9, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, .Fields("Code").Value))
				End If
				.MoveNext()
			End While
		End With
	End Sub
	
	Private Sub lvwTransactions_DoubleClick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lvwTransactions.DoubleClick
		Call cmdEdit_Click(cmdEdit, New System.EventArgs())
	End Sub
	
	'UPGRADE_WARNING: Event Option1.CheckedChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub Option1_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Option1.CheckedChanged
		If eventSender.Checked Then
			Frame1.Enabled = True
		End If
	End Sub
	
	'UPGRADE_WARNING: Event Option2.CheckedChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub Option2_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Option2.CheckedChanged
		If eventSender.Checked Then
			Frame1.Enabled = False
			rsTemp = New ADODB.Recordset
			rsTemp.Open("Select * from tblTransactions", cnBank, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
			With rsTemp
				If .RecordCount > 0 Then
					lvwTransactions.Items.Clear()
					Call LoadListView(rsTemp)
				Else
					MsgBox("Database Empty..", MsgBoxStyle.Information)
					Exit Sub
				End If
				.Close()
			End With
		End If
	End Sub
End Class[/SIZE][/FONT]
 
Last edited:
Thank you MattP for your quick reply .. I really appreciate it.
I'm gonna take a look at those links you gave and try to get the most out of them.
 

Latest posts

Back
Top