How to capture current cell address in a datagrid

G

Guest

Hi

How to capture the current cell address in a datagrid on vb.net ? In which event? I just want to store the current cell address in a global variable. This global variable should get an update everytime the user changes the control in the datagrid to a different cell which becomes current cell

Note: I found that most other queries here talked of currentcell as a property. But for the datagrid name i have created, i do not find any such thing as eg. datagrid1.currentcell. In fact, for datagrid1, i dont find events such as currentcellchanged etc that all of you seem to be talking of

Since i am literally a novice, i would appreciate if you can explain in detail where i am going wrong and how to go abt it in the right way

Regards
Giri
 
M

Morten Wennevik

Hi Giri,

The CurrentCell property is not available at design time so it won't show
in the properties page in Visual Studio, but you can call it to get or set
a datagrid's currently focused cell at runtime.

Make a DataGridCell and update it every time the CurrentCellChanged event
is called (the event is there, just keep looking).


Happy coding!
Morten Wennevik [C# MVP]
 
G

Guest

Hi Morten Wennevik

Well, i did create a datagrid on my web-page and its called "datagrid1". Now in my code-behind i.e in the vb page, all the controls available in this page are listed in the drop-down on the toolbar. Now, i can select my control i.e datagrid1 such that the adjoining drop-down contains the events that are available for the control selected. Here, i find that there are events such as "ItemDataBound", "SelectedIndexChanged" etc (a total of 16 events) but none of them look anything like "CurrentCellChanged"

So... i am still stuck! Request your help further. Thank You

Regards
Giri
 
M

Morten Wennevik

Well Giri, that explains a lot. This news group is dedicated to windows
forms. And the

(System.Windows.Forms.)DataGrid

that you use in a windows application, is very different from

(System.Web.UI.WebControls.)DataGrid

that you use on a web page.

For web controls you might have better luck in

microsoft.public.dotnet.framework.aspnet.webcontrols


Happy coding!
Morten Wennevik [C# MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top