Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 20th, 2008, 04:06 AM
gayatheri gayatheri is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 gayatheri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 34 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old May 20th, 2008, 05:51 AM
zynder's Avatar
zynder zynder is offline
Not much of a contributor
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2006
Location: Hidden
Posts: 1,006 zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)  Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 5 Days 7 h 16 m 20 sec
Reputation Power: 1087
Send a message via Yahoo to zynder
Facebook
i suggest you stay away with bound controls like datagrid. Use other alternative like listview or flexgrid. Trust me with this, datagrids are evil.

Reply With Quote
  #3  
Old May 20th, 2008, 09:05 PM
gayatheri gayatheri is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 2 gayatheri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 34 sec
Reputation Power: 0
but it a requirement to use the datagrid..

hmm could u suggest how to use the msflexgrid align with the problem i stated above??

Reply With Quote
  #4  
Old May 20th, 2008, 09:16 PM
medialint's Avatar
medialint medialint is offline
Type Cast Exception
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Apr 2004
Location: Oakland, CA
Posts: 14,063 medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)medialint User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1Folding Points: 319635 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 3 Weeks 4 Days 11 h 47 m 14 sec
Reputation Power: 6123
Facebook
Quote:
Originally Posted by zynder
i suggest you stay away with bound controls like datagrid. Use other alternative like listview or flexgrid. Trust me with this, datagrids are evil.


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.

Reply With Quote
  #5  
Old May 21st, 2008, 06:43 PM
zynder's Avatar
zynder zynder is offline
Not much of a contributor
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2006
Location: Hidden
Posts: 1,006 zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)zynder User rank is General 2nd Grade (Above 100000 Reputation Level)  Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1Folding Points: 201535 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 5 Days 7 h 16 m 20 sec
Reputation Power: 1087
Send a message via Yahoo to zynder
Facebook
the problem with binding is the lack of flexibility especially with a datagrid control.

@media

Quote:
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)


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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Datagrid and datacombo linking


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek