|
-
Oct 26th, 2011, 02:23 AM
#1
Thread Starter
New Member
[RESOLVED] Code does not execute after For Each Next Loop

I am calling a sub from a form load event. The procedure that is being called adds columns to a listview and then loops through an array to populate the listview. I have another procedure called after the loop that does not execute when the loop completes. Please advise as to what I am doing wrong for the code not to execute after the loop in the if/then/else statement or why it is not executing if I remove the if/then/else statement and just placed the called sub after the loop or why the code does not go back to the form load event and then call the next called sub. Code below:
Code:
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Startup As frmRPMSStartup
Dim login As frmRPMSLogin
Dim EmployeeName As String
Try
'some code to fill labels here
Firstcalledsub()
Secondcalledsub()
Catch ex As Exception
Throw ex
MessageBox.Show("Error on log-in " & ex.ToString, "Log-in error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
End Try
End Sub
HTML Code:
Sub Firstcalledsub()
'Create columns in listview
With lstvListview .View = View.Details
.LabelEdit = True
.FullRowSelect = True
.GridLines = True
.Columns.Add("string", 65, HorizontalAlignment.Left)
.Columns.Add("string", 400, HorizontalAlignment.Left)
.Columns.Add("string", 400, HorizontalAlignment.Left)
.Columns.Add("string", 400, HorizontalAlignment.Left)
.Columns.Add("string", 65, HorizontalAlignment.Left)
.Columns.Add("string", 75, HorizontalAlignment.Left)
.Columns.Add("string", 100, HorizontalAlignment.Left)
.Columns.Add("string", 100, HorizontalAlignment.Left)
.Columns.Add("string", 75, HorizontalAlignment.Left)
.Columns.Add("string", 120, HorizontalAlignment.Left)
.Columns.Add("string", 175, HorizontalAlignment.Left)
.Columns.Add("string", 60, HorizontalAlignment.Left)
.Columns.Add("string", 75, HorizontalAlignment.Left)
.Columns.Add("string", 100, HorizontalAlignment.Left)
.Columns.Add("string", 100, HorizontalAlignment.Left)
.Columns.Add("string", 50, HorizontalAlignment.Left)
.Columns.Add("string", 30, HorizontalAlignment.Left)
End With
'Create item to hold contents of handover array
Dim itm As ListViewItem
Dim arrayitems As String
Dim i As Integer = 0
If IsNothing(array) Then
ToDoListItems()
Else
For Each arrayitems In Datarray
'Add data from Database logins array to listview item
itm = New ListViewItem(New String() {array(i, 0), array(i, 1), array(i, 2), array(i, 3), array(i, 4), array(i, 5), array(i, 6), array(i, 7), array(i, 8), array(i, 9), array(i, 10), array(i, 11), array(i, 12), array(i, 13), array(i, 14), array(i, 15), array(i, 16)})
'Add item to Handover listview
lstvHandover.Items.Add(itm)
i += 1
Next
Secondcalledsub()
End If
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|