No need to declare variables in form events?

Maxxoy

New member
Joined
Nov 3, 2022
Messages
1
Programming Experience
Beginner
Hi,

I am curious and I cannot find a proper answer to this. I am used to declare variables all the time. But here I have a case that I needed to use DataGridView's CellContentClick event to read Checkbox type cell values. And in the solutions I can google there are no variables declared for DataGridView itself anywhere in such cases.

So why is it like that? Can I still declare a variable for that DataGridView?
Thank you for comments.

Private Sub ViewTracksDataGridView_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles ViewTracksDataGridView.CellContentClick

Select Case ViewTracksDataGridView.Columns(e.ColumnIndex).Name
Case "ColumnSpectrumOK" 'user clicked in SpectrumOK checkbox column
ViewTracksDataGridView.EndEdit()
'do the calculations
End Select

End Sub
 
I cannot find a proper answer to this.
Um, yes you can, and you have. I know this because I gave it to you at a different site. I don't want to discourage you from posting at this site but there was literally no need to post this here because you've already been told what the situation is.

As we're here though, please explain what you think the alternative would be. Where do you think this variable should be declared and why?
 
Back
Top