Hi,
I have a code, detecting the last input from textfield into listbox.
this code below is working as long as the rows is visible on the listbox.
the listbox has 500 rows, how to make the listbox scrolling the position into the top position while the bFound is true.
any helps
thanks
arief
dim i as integer
dim s as string
s = EditField3.Text.trim
timer2.Enabled=true
for i = 0 to listbox6.ListCount -1
Dim o as integer
dim bFound as boolean
bFound = false
dim lr as integer
if listbox6.cell(i,0).Trim = s then
for o= 0 to Listbox1.ListCount-1
if Listbox1.Cell(o,0)=listbox6.cell(i,0) then
Listbox1.Cell(o,0)=listbox6.cell(i,0).Trim
Listbox1.Cell(o,1)=l_date.text
Listbox1.Cell(o,2)=l_time.text
Listbox1.Cell(o,3) =listbox6.cell(i,1).Trim
Listbox1.cell(o,4) = listbox6.cell(i,2).Trim
label2.text= "Terakhir di Scan : "+listbox6.cell(i,1).Trim
Listbox1.cell(o,5) = str(val(Listbox1.cell(o,5)) +val(EditField2.text))
bFound = true
lr=o
end if
next o
if bfound = false then
Listbox1.AddRow ""
lr = Listbox1.LastAddedRowIndex
Listbox1.cell(Listbox1.LastIndex,0) = listbox6.cell(i,0)
Listbox1.cell(Listbox1.LastIndex,1) = l_date.text
Listbox1.cell(Listbox1.LastIndex,2) = l_time.text
Listbox1.cell(Listbox1.LastIndex,3) = listbox6.cell(i,1).Trim
Listbox1.cell(Listbox1.LastIndex,4) = listbox6.cell(i,2).Trim
label2.text= "Terakhir di Scan : "+listbox6.cell(i,1).Trim
Listbox1.cell(Listbox1.LastIndex,5) = str(val(Listbox1.cell(o,5)) +val(EditField2.text))
end if
EditField3.text=""
Listbox1.SelectedRowIndex=lr
EditField3.SetFocus
end if
next i
check_last
Listbox1.ScrollPosition=Listbox1.LastRowIndex