![]() |
| ||
| FlexGrid issue and error "Invalid Row value".... Hi, I have used a Flex Grid control in displaying a set of records from the MS ACCESS database (back end) with the means of VB6 code (front end). In my database i have 9 records and the flex grid control has been deisgned at design time with 7 rows. I have full- compiled my code and seen that NO syntax errors exist. ISSUE: At runtime, when the grid control retrieves the 9 records from the db, an error is popped up: "Invalid Row Value". I have tested and seen that if there are 7 records in db, then no errors occur. But, at runtime, if the records queried, exceed the no of rows in the grid control, designed at design time, then this error occurs. And even no vertical scrollbar appears. ---------------------------------------------------------------------- Visual Basic 6 code: ---------------------------------------------------------------------- ''''For loop counters for each cell. ex: (0,0) -> (ROW, COL) Dim dblRow_ISBN As Double, dblCol_ISBN As Double '''''coding for the DATAGRID control to populate itself with records '-------------------------------------------------------------- ------------------------------------------------------------- Call Connect_Database ''''database connection code recset.Open "select ISBN, [Book Title], Author, CoAuthor1, CoAuthor2 " _ & "from " & strTable & " " _ & "order by " & field & "" '------------------------------------------------------------------- If (recset.RecordCount <> 0) Then For dblRow_ISBN = 1 To recset.RecordCount dblCol_ISBN = 0 grdISBN.Row = dblRow_ISBN 'ROW will be same for all the 5 columns grdISBN.Col = dblCol_ISBN grdISBN.Text = recset.Fields("ISBN") grdISBN.Col = dblCol_ISBN + 1 grdISBN.Text = recset.Fields("Book Title") grdISBN.Col = dblCol_ISBN + 2 grdISBN.Text = recset.Fields("Author") grdISBN.Col = dblCol_ISBN + 3 grdISBN.Text = recset.Fields("CoAuthor1") grdISBN.Col = dblCol_ISBN + 4 grdISBN.Text = recset.Fields("CoAuthor2") recset.MoveNext Next dblRow_ISBN End If dbconn.Close 'closes database connection ==================================================== Who can really help me on this ? His help will be definately appreciated. Awaiting reply.... |
| ||
| Re: FlexGrid issue and error "Invalid Row value".... I recommend using something other than the flexgrid. I use the listview all the time. Setup the listview like below and add items. With lvList |
| ||
| Re: FlexGrid issue and error "Invalid Row value".... Hi..buddy, Thanks a lot for ur willingness to help out. And give me an extra edge with a control that i have never used: the ListView, even though I have marked this post as RESOLVED. I will surely refer to ur advice in future, when i need to display records in a manner such as in a grid. QUESTION: ======= I did not understand 2 code lines. Could u pls explain their syntax/pattern for parametres from ur code snippet ?? ************************************************************ lvList.ListItems.Add lvList.ListItems.Count + 1, , "Data: " & CStr(irows) ************************************************************ *********************************************************** lvList.ListItems(lvList.ListItems.Count).ListSubItems.Add 1, , "Sub data 1: " & CStr(irows) *********************************************************** And why do u recommend the ListView , instead of the FLEX GRID ? Becoz, as per after going thru ur code, i am seeing that the ListView cannot draw the vertical & horizontal lines like a grid control. Hence this can lead to visual ambiguity for the reader, when the list is heavily populated with database records. And i feel that the code for the grid that i have stated is much more simple requiring lesser variety of properties, arguments & methods. Infact one does not need to know any syntax to code the Grid control, just a logical visual sequence of steps. But in ur List View, i am having problems to understand the code, becoz i have to learn the new format of the properties & argument patterns used. Please provide a more solid and really simple point to make someone shift from coding the grid to using the ListView in future.... I am not being rude. But lets make it really worthwile to move to another probably better control (fingers crossed) Awaiting ur techies suggestions.... Quote:
|
| ||
| Re: FlexGrid issue and error "Invalid Row value".... '************************************************************ Why would you want to switch? Well the Listview has alot of functionality to it once you learn it. You can make it look alot better and modify the cell data and then even update a database based on the modification. The suggestion is my opinion on using the Listview over the Flexgrid cause like you I use to use the Flexgrid until I ran across the ListView and I was like wow this control is great, I'm going to use this from now on. So if you don't feel comfortable learning a new control then don't but I had to share my opinion. Which is only that, my opinion. I hope you enjoy using either. |
| ||
| Re: FlexGrid issue and error "Invalid Row value".... Sorry, I forgot to post that the ListView can get the grid lines by going to the properties and selecting "GridLines" and change the value to True. If you Right-Click on the control and click Properties you will see a slew of options. Go ahead and play around with them. Its the only way to learn. :D |
| ||
| Re: FlexGrid issue and error "Invalid Row value".... 1 Attachment(s) Thanks a lot for ur code and willingness to help. I have now almost learnt ur newly anticipated ListView control....BRAVO!! I have attached my newly learnt knowledge as a zip file. Please see it and tell me if i am on the right track with the listView control (5 KB). But I still cannot understand this line, mainly the bracketed part only: lvSubjects.ListItems(lvSubjects.ListItems.Count).ListSubItems.Add 1, , "QWE" I know that the above line is used for referring to code details for the subdata item. Please give me a better concept of the bracketed part. Do u also know the deployment stuff of Crystal Report 11, then i can tell u my new issue on that. Maybe u could solve it.... Awaiting ur response.... |
| All times are GMT -4. The time now is 1:38 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC