vb.net - Binding Navigator Navigation Mixed -


i have sdf database setup. problem comes when click movenext button. when keep moving through records goes in order: 23, 24, 25, 32, 26, 27, 28, 29, 30, 31, 33, 34... , on. supposed 25, 26, 27, 28, 29, 30, 31, 32.. , on right?

these numbers auto generated record id incremented every new record

when view records in datagridview order good. ideas how can resolve this?

update sorry late reply. have been trying create alternative route record navigation goes in order of id number. have created variable cur_navid current records id saved. every time next or previous buttons pressed next record in order displayed. thousands of record method tends bit vague. anyways heres main codes

here code for:

new record

 private sub newrecord()     if not isediting = true         enable_edit()         id += 1         me.bindingnavigatoraddnewitem.performclick()          cust_nametextbox.clear()         contacttextbox.clear()         remtextbox.clear()         gradetextbox.clear()         schooltextbox.clear()         v_numbertextbox.clear()         student_nametextbox.clear()          m7_idlabel1.text = string.format("{0:0000}", id)         date_pick.value = datetime.now          statuscombobox.selectedindex = 0         statuscombobox.text = "to done"         setstatus(statuscombobox.text)          cust_nametextbox.focus()     elseif isediting = true         dim di dialogresult = msgbox("do want save current record?", msgboxstyle.yesnocancel)         if di = windows.forms.dialogresult.yes or di = windows.forms.dialogresult.ok             saverecord()             newrecord()         elseif di = windows.forms.dialogresult.no             canceledit()         elseif di = windows.forms.dialogresult.cancel             exit sub         end if     end if end sub 

save record

private sub saverecord()     try         '// customers multiple lists. easier entry          lastmember.cust_name = cust_nametextbox.text         lastmember.contact = contacttextbox.text         lastmember.grade = gradetextbox.text         lastmember.remks = remtextbox.text         cust_nametextbox.autocompletesource = autocompletesource.customsource         cust_nametextbox.autocompletemode = autocompletemode.suggestappend         dim mysource new autocompletestringcollection()         mysource.add(lastmember.cust_name)         cust_nametextbox.autocompletecustomsource = mysource          me.listsbindingnavigatorsaveitem.performclick()         disable_edit()          msgbox("record saved!", msgboxstyle.information)         'appwait(700)         'listsbindingsource.movelast()           cust_nametextbox.focus()     catch ex exception         ' msgbox("please fill in customer name, contact , grade boxes", msgboxstyle.information)         msgbox(ex.message, msgboxstyle.information)     end try end sub 

binding navigator save item code

private sub listsbindingnavigatorsaveitem_click(sender system.object, e system.eventargs) handles listsbindingnavigatorsaveitem.click     me.validate()     me.listsbindingsource.endedit()     me.tableadaptermanager.updateall(me.bookslistdataset)     my.settings.id = id     my.settings.save() end sub 

and in form load event

    ' ### load data 'bookslistdataset.lists' table.     me.liststableadapter.fill(me.bookslistdataset.lists)     me.bindingnavigatormovelastitem.performclick()       ' ### update counter if database changed     dim chek boolean = maxid(bookslistdataset.tables("lists")) = string.format("{0:0000}", my.settings.id.tostring)     if chek = false         msgbox("database has been updated. application restart compensate changes.", msgboxstyle.information)         ' my.settings.id = me.bookslistdataset.tables("lists").rows(bookslistdataset.tables("lists").rows.count - 1).item(0).tostring         my.settings.id = maxid(bookslistdataset.tables("lists"))         my.settings.save()         application.restart()     else     end if       ' ### take backup     if my.settings.backup_date = nothing         dim di dialogresult = msgbox("do want create backup database?", msgboxstyle.yesnocancel)         if di = windows.forms.dialogresult.yes or di = windows.forms.dialogresult.ok             '//backup database             if not my.computer.filesystem.fileexists(path.combine(application.startuppath.tostring, my.settings.id.tostring & "bookslist.sdf.bak"))                 my.computer.filesystem.copyfile(path.combine(application.startuppath.tostring, "bookslist.sdf"), path.combine(application.startuppath.tostring, my.settings.id.tostring & "bookslist.sdf.bak"))                 my.settings.backup_date = date.today                 my.settings.save()             end if          else             'do nothing         end if     elseif not my.settings.backup_date = date.today or my.computer.filesystem.fileexists(path.combine(application.startuppath.tostring, my.settings.id.tostring & "bookslist.sdf.bak")) = false         dim di2 dialogresult = msgbox("do want create todays backup database now?", msgboxstyle.yesnocancel)         if di2 = windows.forms.dialogresult.yes or di2 = windows.forms.dialogresult.ok             '//backup database             if not my.computer.filesystem.fileexists(path.combine(application.startuppath.tostring, my.settings.id.tostring & "bookslist.sdf.bak"))                 my.computer.filesystem.copyfile(path.combine(application.startuppath.tostring, "bookslist.sdf"), path.combine(application.startuppath.tostring, my.settings.id.tostring & "bookslist.sdf.bak"))                 my.settings.backup_date = date.today                 my.settings.save()             end if          else             'do nothing         end if     end if      ' ### load autopcomplete list     dim autocompletelist new system.windows.forms.autocompletestringcollection     using reader new system.io.streamreader("schools.acl")         while not reader.endofstream             autocompletelist.add(reader.readline())         end while     end using     schooltextbox.autocompletesource = autocompletesource.customsource     schooltextbox.autocompletemode = autocompletemode.suggest     schooltextbox.autocompletecustomsource = autocompletelist      ' ### focus next textbox on enter function part     textboxes.add(cust_nametextbox)     textboxes.add(contacttextbox)     textboxes.add(remtextbox)     textboxes.add(gradetextbox)     textboxes.add(schooltextbox)     textboxes.add(v_numbertextbox)     textboxes.add(student_nametextbox)      disable_edit()     cur_navid = maxid(me.bookslistdataset.tables("lists"))     me.listsbindingsource.position = cur_navid 


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -