•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 427,097 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,333 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 359 | Replies: 7 | Solved
![]() |
•
•
Join Date: May 2008
Posts: 10
Reputation:
Rep Power: 1
Solved Threads: 0
please help me..
i have 40 data to display at msflexgrid. but i cannot do that because it show too many continuations error...
i have 40 data to display at msflexgrid. but i cannot do that because it show too many continuations error...
Public Function show_msflex(SQL As String)
MSFlexGrid1.Rows = 1
Set rekod = New ADODB.Recordset
rekod.ActiveConnection = Con
rekod.CursorLocation = adUseClient
rekod.CursorType = adOpenDynamic
rekod.LockType = adLockOptimistic
rekod.Source = SQL
rekod.Open
If rekod.EOF Then
MsgBox "Sorry, no record in the database"
End If
While Not rekod.EOF()
MSFlexGrid1.AddItem rekod!Name & vbTab & _
rekod!Gender & vbTab & _
rekod!Race & vbTab & _
rekod!Address & vbTab & _
rekod!Address1 & vbTab & _
rekod!Ic & vbTab & _
rekod!passport & vbTab & _
rekod!DOB & vbTab & _
rekod!POB & vbTab & _
rekod!Post & vbTab & _
rekod!State & vbTab & _
rekod!Contact & vbTab & _
rekod!coursecode & vbTab & _
rekod!Citizen & vbTab & _
rekod!Class & vbTab & _
rekod!Sem & vbTab & _
rekod!Admission & vbTab & _
rekod!AdmissionDate & vbTab & _
rekod!Completion & vbTab & _
rekod!Roll & vbTab & _
rekod!Intake & vbTab & _
rekod!How & vbTab & _
rekod!Sponsor & vbTab & _
rekod!status & vbTab & _
rekod!GState
rekod.MoveNext
Wend
Set rekod = Nothing
End Function Last edited by Tekmaven : Jul 18th, 2008 at 5:32 am. Reason: Code tags
•
•
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 459
Reputation:
Rep Power: 1
Solved Threads: 79
Hi, Instead of specifying the field name use field index and a loop.
For Example
But it cannot be in order unless you specify the Fields order in SQL.
For Example
VB Syntax (Toggle Plain Text)
Dim sAdd as String Dim i as Integer For i = 0 To rekod.Fields.Count - 1 sAdd = rekod.Fields(i) & vbTab Next MSFlexGrid1.AddItem sAdd
But it cannot be in order unless you specify the Fields order in SQL.
KSG
Hi,
Check this :
Regards
Veena
Check this :
vb Syntax (Toggle Plain Text)
Dim i As Integer Dim j As Integer i = 0 Do While Not rekod.EOF i= i +1 With MSFlexGrid1 .Rows = i+1 For j = 0 To rekod.Fields.Count-1 .TextMatrix(i , j) =rekod(j) & "" Next End With rekod.MoveNext Loop
Regards
Veena
Last edited by QVeen72 : Jul 18th, 2008 at 9:16 am.
•
•
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 459
Reputation:
Rep Power: 1
Solved Threads: 79
Yes, Veena gives the correct code.
I give another way that use Recordset.GetRows. It may be faster.
I give another way that use Recordset.GetRows. It may be faster.
VB Syntax (Toggle Plain Text)
Dim i As Long Dim j As Long Dim sC As Variant Dim iU1 As Long Dim iU2 As Long Dim sS As String MSFlexGrid1.Clear MSFlexGrid1.Cols = adoRS.Fields.Count MSFlexGrid1.Rows = adoRS.RecordCount + 1 sC = adoRS.GetRows iU1 = UBound(sC, 1) iU2 = UBound(sC, 2) 'No of Records For j = 0 To iU1 MSFlexGrid1.TextMatrix(0, j) = adoRS.Fields(j).Name Next For i = 0 To iU2 For j = 0 To iU1 MSFlexGrid1.TextMatrix(i + 1, j) = sC(j, i) & "" Next Next
KSG
![]() |
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Voice Recognition System
- Next Thread: [Excel Macros] Creating Macros to search and copy columns


Linear Mode