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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrevie data from grid?

Status
Not open for further replies.

Coolprogram

Programmer
Nov 9, 2011
15
LT
Well I need to get data from active row in my grid . I'd like to populate textboxes with data from grid for editing purposes . how can I achieve that?

Best regards
 
this has nothing to do with the grid. Selecting a row in the grid makes it the active row. Simply set textboxes controlsource to alias.fieldname

You might or might not need thisform.refresh() in the grids afterrowcolchange() event. But in general a change of row position in the controlsource is reflected in controls display.

Bye, Olaf.
 
well im trying something like this
thisform.bar_kodas.Value = thisform.grid1.column1.value
and it doesnt work
 
As Olaf said, forget about the grid. Focus on the data in the underlying table or cursor.

If the grid is populated from a cursor named MyCursor, and column 1 is based on a field named MyField, then your code needs to be something like this:

Code:
thisform.bar_kodas.Value = MyTable.MyField

Or, better:

Code:
thisform.bar_kodas.ControlSource = "MyTable.MyField"

Either way, simple do THISFORM.Refresh in the grid's AfterRowColChange.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
It would need to be thisform.grid1.column1.text1.value, but it's better to not adress the grid, it's just displaying the table, so go for the current record in the table.

That concept is valid for other controls, too. Unless you're not adressing THIS.VALUE eg in the moment of validate, rather adress the table/cursor/alias.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top