Select cell problems with DataGridView in csharp

K

Karl

Hi all,

I'm reasonably new to csharp so you have to forgive me asking what may
be a stupid question...

As I said, I'm new to CSharp but in VB I was able to click anywhere on
a DataGridView (so long as it was on a cell or header) and return the
value contained in the first column for the selected row and store that
as a variable or in a textbox.

However, after building the same thing in CSharp if I click on the
cell, but in white space after the value contained in the cell, the
method fails to fire, even though the cell has clearly changed. If I
click on the value in the cell, the method does fire and the value in
the first column of that row is returned.

Is this a bug in CSharp (2005) or am I doing something wrong?
 
K

Karl

I found out why this is happening, but not sure how the situation
arose?

In the form designer file there was no line which defined the CellClick
event.

I really want to like CSharp and the language is already pulling me in,
but the Visual Studio 2005 environment seems to be really flakey,
unless I am missing the point on some of these 'issues' ?

In VB, when I look at the code for a form, I can choose a control and
then choose its events from drop downs at the top of the screen. These
seem to be different in CSharp and this is making the transition from
VB to CSharp a little more difficult than I had hoped!

My fault entirely of course... I'll shut up now!
 
R

rhaazy

In VS you can select an object, then in the properties window (at the
top) you can choose to see properties (default) ,events (by selecting
the lightning bolt), etc...

To get the functionability you are looking for, I believe you want to
look into tablestyles and you will also want to probably use the
oncellchange event...
 

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