Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrolling through a dataset

Status
Not open for further replies.

arrian

Programmer
Joined
Nov 11, 2003
Messages
93
Location
CA
Hi! I'm having a problem with my program here. I have several text boxes that display 12 rows in a dataset. The code I'm currently using for the scroll procedure is as follows:

For Each rowRows In dsDrawings.Tables(0).Rows
'Checks if the current row is requested and adds it to the appropriate text boxs
If intCount >= (Num - 11) And intCount <= Num Then
arrDNum(i).text = rowRows("dwg_number").ToString
arrRNum(i).text = rowRows("rev_number").ToString
arrClient(i).text = rowRows("company_name").ToString
arrTitleA(i).text = rowRows("title1").ToString
arrTitleB(i).text = rowRows("title2").ToString
arrDesc(i).text = rowRows("description").ToString
arrTag(i).text = rowRows("tag_number").ToString
arrDP(i).text = rowRows("dwg_path").ToString
If LastTag < Val(rowRows("tag_number")) Then
LastTag = Val(rowRows("tag_number").ToString)
End If
i = i + 1
ElseIf intCount > (Num + 11) Then
Exit For
End If
intCount = intCount + 1
Next

This checks for the number of times it's gone through the loop to be equal to the new value of the scroll bar. The problem is, with a large dataset(7000+ records), the further down you go, it gets a LOT slower. Now, I know WHY this happens, and I know that it SHOULD happen. I just need to know if maybe there's a better way to do this? There's got to be SOMETHING that's more effiscient!!!
 
Are you displaying 8x7000 text boxes at any given time?

7000 records is a lot of info. More infact then any user will ever be able to look at at one time. reduce what you are displaying. Let the user filter/search the data instead of reading though 7k+ lines looking for the one(s) they want.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
No, I've only got 12 text boxes displayed. The boxes are static. Every time you scroll, the procedure moves to the next record. Basically, each time, it goes through the dataset until it finds the appropriate amount of times through, and then fills the text boxes with the data from the dataset for those rows. This worked great when I tried it with a dataset of 3000 or so records, but now that I have the full database to work with, It's over 7000 records, and as it gets lower in the dataset, it takes longer to find the record, and therefore takes longer to scroll. This gives it the appearance of lagging as you get to the bottom.

If I could, I would use the primary key, but the problem with that is that the key is not allways sequential. The next number will allways be bigger, but there are some gaps here and there.
 
As Rick says 7000 records is quite a lot, but something most grids could handle, even the M$ Datagrid. There is obviously some reason why you are effectively creating your own grid?.

Selective filtering has to be the way to go.


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
The reason I'm creating my own grid is that I need scrollable text boxes, and may need to put in combo boxes. If there was a grid that would allow me to do that allready made, that would be fantastic!
 
You may want to check out the Component 1 Flex grid.

Also, instead of moving through the datatable row by row to find the desired row, use the select method.

Code:
dim dr() as datarow
dr =  dsDrawings.Tables(0).select("FieldName = Value")
select case dr.length
  case = 0
    'No records found
  case = 1
    '1 record found, display as normal
  case > 1 
    'multiple records found. Likely a data error if you 
    'selected on a unique key.
end select

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
I only started looking at the C1 Flex Grid the other day, but I know Rick uses that a lot, whereas I mainly use the C1 TrueDBGrid.

The Flex grid does seem to be very powerful, in what it can do, and it looks a doddle to incorporate combos, but not sure about scrollable text, but as you can apparently bind a column to a class I can hardly see that been a problem.

However such flexibility does come at a cost, but it will be a cost far less than you trying to develop your own components. You can download these componeents for free for evaluation (no time limit), but you do get a nag screen every time one of C1's controls is used. Still it gives you time to see if it does exactly what you want it to do.




Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Where can I get the C1 Flex Grid component, then?
 
Ok, I'm going to try it out, thanks for the advice!
 
Ok, I've downloaded the C1 Flex Grid, but I'm having some trouble populating it... Any ideas on how I might do this? I'm pulling data from a My SQL database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top