Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,188 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,131 people online right now. Registration is fast and FREE... Join Now!




How to check for EOF or BOF

 
Reply to this topicStart new topic

How to check for EOF or BOF, what do I do to check EOF or BOF

Rating  5
westmatrix99
30 Sep, 2007 - 03:15 AM
Post #1

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
CODE
If MSFlexGrid1.Row <> 1 Then
cmdRemoveEntry.Enabled = True


If MSFlexGrid1.Row <> 1 Then... what do I do to check EOF or BOF

Not sure how to check this in VB.

Cheers
West
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 04:38 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Checking for BOF and EOF doesnt require a FlexGrid, you do that with your RecordSet Object, like

CODE

'Check for EOF (End Of File)
If Not MyRecordSet.EOF Then
       'Do something because theres
       'more records available
Else
        'We're at the end of the records
Else

'Check for BOF (Beginning of File)
If Not MyRecordSet.EOF Then
       'MoveFirst will move the pointer
       'to the first record in the recordset
       MyRecordSet.MoveFirst
End If


Hope this helps smile.gif
User is offlineProfile CardPM
+Quote Post

westmatrix99
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 07:46 AM
Post #3

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
Thanks am trying that now.

Where did you learn that?

Cheers
West

QUOTE(PsychoCoder @ 30 Sep, 2007 - 05:38 AM) *

Checking for BOF and EOF doesnt require a FlexGrid, you do that with your RecordSet Object, like

CODE

'Check for EOF (End Of File)
If Not MyRecordSet.EOF Then
       'Do something because theres
       'more records available
Else
        'We're at the end of the records
Else

'Check for BOF (Beginning of File)
If Not MyRecordSet.EOF Then
       'MoveFirst will move the pointer
       'to the first record in the recordset
       MyRecordSet.MoveFirst
End If


Hope this helps smile.gif


User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 07:50 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
I learned from many, many years of being a professional programmer, don't worry, things like this will come with time, just don't give up smile.gif

W3 Schools has some handy information on the ADORecordSet object you might find useful smile.gif
User is offlineProfile CardPM
+Quote Post

westmatrix99
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 07:54 AM
Post #5

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
This is my Form_Load() event:
CODE
Private Sub Form_Load()
'the format string just lets you define a format for how
'your flexgrid will appear
MSFlexGrid1.FormatString = "Artist Name             |" & _
        "Album Name                                 | Tracks"

'make sure the search path to the db is always in the right spot
Data1.DatabaseName = App.Path & "\CDCollection.mdb"
'set up the recordsource for the datasource and flexgrid control
'in this case, it's just a raw SQL query, simple simple.
Data1.RecordSource = "select * from CDs order by ArtistName"

End Sub


I got this off a site some years ago and am trying to play with it now.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 08:00 AM
Post #6

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Are you getting an error? What is your question?
User is offlineProfile CardPM
+Quote Post

westmatrix99
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 08:08 AM
Post #7

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
Sorry just added more info there.

Am playing with the code now.
Will post it once complete as it's a CD collection app and I would like others to have a useful and working copy of it.

User is offlineProfile CardPM
+Quote Post

westmatrix99
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 12:46 PM
Post #8

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
Here is my complete code attached.
It's in raw format so you can change what you need and compile it yourself.

It has sort, search and my famous print functions, please enjoy it.
Didn't have time to create a tut on it.

I hope that others can learn from it.

Attached File  CDCollection.zip ( 42.35k ) Number of downloads: 42


This post has been edited by westmatrix99: 30 Sep, 2007 - 09:51 PM
User is offlineProfile CardPM
+Quote Post

westmatrix99
RE: How To Check For EOF Or BOF
30 Sep, 2007 - 01:24 PM
Post #9

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
How do I add to this site?

A snippet to the snippets section...
A tutorial and so on...

I found this but no help to me.
http://www.dreamincode.net/?p=about

It says:

Write a Tutorial(+50 Kudos)
Add a Code Snippet(+25 Kudos)

But it doesn't take me to upload my tuts.

I may have missed something, could be tired.

This post has been edited by westmatrix99: 30 Sep, 2007 - 01:27 PM
User is offlineProfile CardPM
+Quote Post

Louisda16th
RE: How To Check For EOF Or BOF
1 Oct, 2007 - 04:42 AM
Post #10

 
Group Icon

Joined: 3 Aug, 2006
Posts: 1,790



Thanked: 1 times
Dream Kudos: 755
My Contributions
To post a snippet in Visual Basic, CLICK HERE. Now click the Add Snippet button on the top right corner.

To post a tutorial in Visual Basic, CLICK HERE. Now click New Topic on the top right corner.

These links refer to VB only. For other languages, go to the appropriate section and click the Add Snippet or New Topic button.
User is offlineProfile CardPM
+Quote Post

westmatrix99
RE: How To Check For EOF Or BOF
1 Oct, 2007 - 05:00 AM
Post #11

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 18


My Contributions
Thank you.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 01:19AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month