Hi,
“Window2” of my software contains “TextField1” and a button.
When the user clicks on the button, I want the contents of “Window2.TextField1” to be compared to the second column of “Window1.ListBox1” (in order to prevent a duplicate entry before saving it).
Could someone please tell me if my code below would achieve that part (the comparison).
[code]// Loop through the rows.
for iRow As Integer= Window1.ListBox1.ListCount - 1 DownTo 0
// Loop through the second column for each row
for iCol as integer = 1
// Check if TextField1.Text is the same as in any of the second columns
// IS THE LINE OF CODE BELOW CORRECT ???
if Window2.TextField1.Text = Window1.ListBox1.cell(iRow, iCol) Then
//Text in TextField1 already exists in another column 2 cell
MsgBox(“Please enter a unique reference number.”)
else
// save the contents of Window2.TextField1 to Window1.ListBox1
blah blah blah
end if
// Exit the loop
Exit
end
next
next[/code]
Hope my question made sense - and thank you all in advance.