private void ViewContent(object sender, EventArgs e) { var smsData = dataGridView.SelectedRows[0].DataBoundItem as SmsData; if (smsData != null) { var newSmsData = new SmsDataForm(smsData.Id, currentUser); var result = newSmsData.ShowDialog(); } }