Solved

I want to set column header caption and data source of a DataGrid Control at run time.

Posted on 2002-04-24
7
170 Views
Last Modified: 2010-05-02
I want to know how to set the data source of a data grid control at run time.  my data source is an ADO recordset.

I try to use set DataGrid1.dataSouce=ADORec but it doesn't works. (No error)

Please give me the coding.
0
Comment
Question by:yongyih
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6967426
have you refresh the grid?

datagrid1.refresh
0
 
LVL 2

Author Comment

by:yongyih
ID: 6967524
sorry... i just found the solution.
after i add in this statement, the grid can display all the records from database.

.CursorLocation = adUseClient

Now online to delete this question.  Since you post a comment already, how about you tell me how to set the caption of the DataGrid? The column header.  Because it is follow the table fields name when display.

0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 50 total points
ID: 6967556
Try: DataGrid1.Columns(i).Caption = "Hello World"
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Expert Comment

by:stelamb
ID: 6968048
yongyih,

In the SQL you use to return the dataset redefine the headings using something like

SELECT lastname AS [Surname],
       firstname AS [Christian Name]
FROM   tblname

for example
0
 

Expert Comment

by:stelamb
ID: 6968049
yongyih,

In the SQL you use to return the dataset redefine the headings using something like

SELECT lastname AS [Surname],
       firstname AS [Christian Name]
FROM   tblname

for example
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 6968087
ryancys and stelamb already gave you correct comments.

BTW stelamb, welcome to EE but take some time to read http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp. A valid comment was already posted (by ryancys). You should have post a comment.
0
 
LVL 2

Author Comment

by:yongyih
ID: 6968707
I cannot accept your comment as answer because ryancys already gave a correct answer.  But your answer is correct and very useful too. thanks.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now