Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid 1

Status
Not open for further replies.

FredNg

Programmer
Jun 25, 2003
4
MU
Hi everybody

How do I display data to a particular cell in the datagrid ?
Say I want to display some data in the cell in column 5, row 2

Thanks
Fred



 
A VB DataGrid is not a FlexGrid.
If we are talking about a VB OLEDB DataGrid, then use the recordset, which the grid is bound to, to move to the record in question (the grid row should move automtically) and then update the field by either setting the column value:
DataGrid1.Columns(5).Value = "Something"

or by updating the recordset field:

myRS.Fields("myField").Value = "Something"

(if using a DC, replace myRS with the DC Recordset as in Adodc1.Recordset)

Again, the grid should update automatically
 
CCLINT as from today I'll call you teacher
I understand what you mean but since I've created a form to record new data meaning it is not yet inputed in the recordset. So how can I point to this particular row if it is not created yet.
See I want user to input name of user in text box and click on a command button which will copy the contents of the textbox to a particular cell say row1,column0. As mentioned in my other post I have tried doing it with a flex grid by writing
With FlexGrid1
.Rows = 2
.Col = 0
.Row = 1
.text = txtName.text
End with
It worked. Problem with the flexgrid is that during run time user cannot type in a cell in the flexgrid (or is it possible ?) This is why I opted for a data grid.
I guess it's because the flexigrid is an unbound form.
How the hell will I do it in datagrid. Your suggestion would seem to point to an already existing recordset which in my case is not.

Any idea
Thanks
Fred

 
1.
myRS.AddNew
myRS.Fields("myField1").Value = Text1.Text
myRS.Fields("myField2").Value = Text2.Text
myRS.UpdateBatch

2.
A Flex grid is not directly editable, except in code, but there are methods of getting around this by placing a textbox directly over the cell to be edited, also sizing it to the dimensions of the cell.
Pleanty of examples in this forum and I even think in the FAQ.
Please do a search here, and also check the FAQs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top