Solved

SSDBGRID how to set text

Posted on 1997-04-29
4
1,229 Views
Last Modified: 2012-05-04
Hi, My proble is that i dont seem to be able to set text
to a ssdbgrid colum I've tried this
SSDBGrid1.colums(1).text = MyStr     I've also tried this
SSDBGrid1.colums(1).text = "text"    and
SSDBGrid1.colums(1).text = MyRs!fieldname
ps. if set the properties to bound mode
But nothing seems to work!
Is there a other way of setting text to the ssdbgrid?
0
Comment
Question by:ec97-44
  • 2
4 Comments
 

Author Comment

by:ec97-44
ID: 1425796
Edited text of question
0
 
LVL 7

Expert Comment

by:tward
ID: 1425797
If it is anything like a regular grid try the following:

SSDBGrid1.Row=1
SSDBGrid1.Col=1
SSDBGrid1.text="TEXT"

In a grid you have to pick your row and column first then set the text of that row/column to what you want...  Hope this helps you out!
0
 

Author Comment

by:ec97-44
ID: 1425798
I 've reasently solved the problem my self and the solution looks
like this
SSDBGrid1.columns(1).text = MyText
The problem that i had was following:
1. I tried to set text to a column that was bounded to an key field
2.I had misspeld columns like this colums whitout n after m

I havent tried your solution but i don't think that would work
because the ssdbgrid is in bounded mode and textpropertis can only be put in the way i did.
My result for your solution can only be rated to poor but thanks
anyway
0
 

Accepted Solution

by:
mikekr earned 100 total points
ID: 1425799
If the SSDBGrid is in bound mode, and you are trying to add new data to the grid, the easiest way is to add it to the recordset.
i.e. If SSDBGrid1 is bound to Data1, use this code :-

Data1.recordset.addnew
Data1.recordset!fieldname1=data1
Data1.recordset!fieldname2=data2
Data1.recordset.update

That should add a new row to the grid and display the data that was entered.

If the SSDBGrid is in additem mode then use the AddItem method:-

SSDBGrid1.AddItem data1,data2

This would add a new row and enter the value of data1 into column 0 and the value of data2 into column1. NB! The FieldSeparator property of SSDBGrid1 must be set to "," for this code to work.

If you want to programatically change the contents of a cell in the grid. Make sure you are on the correct row in the grid, and use:-

SSDBGrid1.columns(0).text=Mytext1
SSDBGrid1.columns(1).text=Mytext2

You could also use the following code to change the contents of the recordset that is bound to SSDBGrid1:-

Data1.recordset.edit
Data1.recordset!fieldname1=data1
Data1.recordset!fieldname2=data2
Data1.recordset.update

Of course, there are various ways of making sure that you are in the correct row of the grid or that you are pointing at the correct record in the recordset before the changes are made.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Word macro - how to get characters after the searched for string 5 97
using web browser with BING 40 132
VBA Shell can't Find Word document 11 114
TT Auto Dashboard 13 95
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

820 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