TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chris Anderson
NA
93
9.1k
Open a UserControl when a column button is clicked (Windows App Form)
Feb 10 2021 9:02 PM
When a column button is clicked I wonder how I can get that data for that particular row.
For instance below I would like to get the data for the object of Puppypuppy and pass on the data to a UserControl (which in my case is a simple window that I want to populate with the data from the clicked button)
The code for the event when a button is clicked:
private
void
dataGridView1_CellContentClick_1(
object
sender, DataGridViewCellEventArgs e)
{
var senderGrid = (DataGridView)sender;
if
(senderGrid.Columns[e.ColumnIndex]
is
DataGridViewButtonColumn &&
e.RowIndex >= 0)
{
// How to get the data of an object when a column button is clicked and pass it to a user control?
// UserControlPlayAnimal playAnimals = new UserControlPlayAnimal();
}
}
Reply
Answers (
3
)
MVc .net framework
Get the properties from array in object to populate dataGridView