Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next
Move Previous/Move Next Move Previous/Move Next
Move Previous/Move Next
Go Back  Xtreme Visual Basic Talk > > > Move Previous/Move Next


Reply
 
Thread Tools Display Modes
  #1  
Old 03-08-2012, 07:59 AM
kimt kimt is offline
Centurion
 
Join Date: Mar 2003
Posts: 144
Default Move Previous/Move Next


Trying to have the user be able to move alphabetically through a db in .net. The user picks a record from a listview and then:
Code:
If frm.lvwDisplay.SelectedIndices.Count = 0 Then Exit Sub Else intID = CInt(frm.lvwDisplay.SelectedItems(0).Text) dataMgr.FindOneName(intID, nMember) 'nMember a class of members dataMgr.GetAbsRec(iID) End If Public Function GetAbsRec(ByVal iMemberID As Integer) As Integer Dim abspos As Integer Dim dtr As DataRow For i = 0 To ds.Tables("Members").Rows.Count - 1 ' this is where it falls apart. 'Object reference not set to an instance of an object. dtr = ds.Tables("Members").Rows(i) If dtr.Item("MemberID") = iMemberID Then abspos = i End If Next Return abspos Exit Function End Function
Once this hurdle is cleared, the data from the next record is displayed.

Any help is appreciated. thanks
Reply With Quote
  #2  
Old 03-08-2012, 08:31 AM
DrPunk's Avatar
DrPunkMove Previous/Move Next DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

From the error message you're giving either the dataset ds is nothing, or there is no table "Members" inside dataset ds. It's not possible from that code segment you've posted to determine which. It should be possible to tell from the IDE though when it errors on that line.
__________________
There are no computers in heaven!
Reply With Quote
  #3  
Old 03-08-2012, 08:36 AM
DrPunk's Avatar
DrPunkMove Previous/Move Next DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

It appears that you have option explicit off (you use variable i without declaring it).

You really should program with option explicit on (check the compile page of the project properties to change it, and change it in the tools->options as well so every project has it set).

If you set explicit on then you're program will likely have tons of errors for you to fix but the likelihood of falling into silly mistakes (like typing a variable name wrong and the IDE doesn't care, it'll just create a new variable and you'll be trying to work out why something doesn't work for aaaaaages) is greatly reduced.
__________________
There are no computers in heaven!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next Move Previous/Move Next
Move Previous/Move Next
Move Previous/Move Next
 
Move Previous/Move Next
Move Previous/Move Next
 
-->