Solved

Setting grid cell text

Posted on 1997-12-10
4
352 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 65
Specify ip address in my connection string for sas 2 52
Excel VBA combine two working workbooks 8 46
Using "ScreenUpdating" 6 55
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

932 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

13 Experts available now in Live!

Get 1:1 Help Now