|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Datagrid and datacombo linking
hi
im currently developing a system using visual basic 6.0 with the access database. the wizard contains:- 1) datagrid 2) datacombo 3) command button i manage to retrieve the data from accesss. and i manage to display the data selected from data combo to the datagrid but it display the whole data base content. my problem now is, i want the datagrid to show data for only the selected item from the datacombo. could u pls kindly help me out with this.thank u for ur kindness. regards gayatheri |
|
#2
|
||||
|
||||
|
i suggest you stay away with bound controls like datagrid. Use other alternative like listview or flexgrid. Trust me with this, datagrids are evil.
|
|
#3
|
|||
|
|||
|
but it a requirement to use the datagrid..
hmm could u suggest how to use the msflexgrid align with the problem i stated above?? |
|
#4
|
||||
|
||||
|
Quote:
I disagree about data bound controls! I don't normally use datagrids specifically but I do use bound controls. Although if I'm using access I just do all the development in access. In this case all the controls can be data bound. Data binding is very efficient for some interfaces with vast amounts of data, including data from disparate databases (local mdb joined with oracle, for example) -- edit // mmm ... maybe I'm just bickering over semantics in the end ... "data binding". The datagrid in vb6 is admittedly pretty lacking ...
__________________
medialint.com I have heard there are troubles of more than one kind. Some come from ahead and some come from behind. But I've bought a big bat. I'm all ready you see. Now my troubles are going to have troubles with me! - Dr. Seuss Last edited by medialint : May 20th, 2008 at 09:24 PM. |
|
#5
|
||||
|
||||
|
the problem with binding is the lack of flexibility especially with a datagrid control.
@media Quote:
actually it depends on the approach. both can be efficient. when dealing with vast amounts of data, i usually use paging techniques when displaying the data. @gayatheri you can use msflexgrid.textmatrix (row,col) to populate data. just put your incrementing variable to row,col inside the loop. if you are populating very large data at once, use paging techniques or .Clip property combine with recordset.getstring sample: Code:
Private Sub Command1_Click()
Screen.MousePointer = vbHourglass
Set rs = New ADODB.Recordset
strsearch = "SELECT * FROM TblName ORDER BY AnyField"
rs.Open strsearch, adoc, adOpenDynamic, adLockOptimistic
rs.Requery
If rs.RecordCount = 0 Then
MSFlexGrid1.Clear
MsgBox "No record found"
Screen.MousePointer = vbNormal
Exit Sub
ElseIf rs.RecordCount >= 1 Then
'populate flexgrid box
With MSFlexGrid1
.Clear
.Rows = rs.RecordCount + 1
.Cols = rs.Fields.Count - 1
.Row = 1
.Col = 0
.RowSel = .Rows - 1
.ColSel = .Cols - 1
.Clip = UCase(rs.GetString(adClipString, -1, Chr(9), Chr(13), vbNullString))
.Row = 1
End With
End If
Screen.MousePointer = vbNormal
End Sub
In this case, the recordset is treated as string so no loop is needed when populating a flexgrid. Displaying large records from the database is extremely fast. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Datagrid and datacombo linking |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|