Solved

Setting grid cell text

Posted on 1997-12-10
4
358 Views
Last Modified: 2012-05-04
What code should I use to set cell text for either a grid control or a DBgrid control, the following does not seem to work:
DbGridName.Columns(1).CellValue ("text")  nor
DbGridName.Columns(1).CellText ("text")
0
Comment
Question by:ncw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
leeal earned 100 total points
ID: 1444634
Grid:
Grid1.text = "Data for the current cell"

DBGrid:
DBGrid1.Columns(1).Text = "Text to be displayed in the cell"
DBGrid1.Columns(1).Text = "Data to be contained in the cell"

0
 
LVL 1

Author Comment

by:ncw
ID: 1444635
Yes, got that to work with 'Grid' but an error message says "this property not available" for 'DBGrid', does it need to be the 32-bit version?
0
 
LVL 1

Expert Comment

by:leeal
ID: 1444636
umm.... not sure...
What I suggest is to make sure that you have typed (for DBGrid):
   DBGrid1.Columns(1).Text = "whatever"
instead of:
   DBGrid1.Text = "whatever"

where 'Columns' is a collection of the columns in the grid, and the number within the parenthesis is the index of the column.
- DBGrid1.Columns(0) is first column
- DBGrid1.Columns(1) is 2nd column, etc...

btw, I mistyped something in my answer for DBGrid. It should be:
DBGrid1.Columns(1).Text = "Text to be displayed in the cell"
DBGrid1.Columns(1).Value = "Data to be contained in the cell"

sorry... :p
0
 
LVL 1

Author Comment

by:ncw
ID: 1444637
Thanks for your comment. I understand your code, but for some reason the message still appears - "the object does not support this property"
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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