如何在消息框中获取 DataGridView 单元格值? [英] How to get DataGridView cell value in messagebox?

查看:22
本文介绍了如何在消息框中获取 DataGridView 单元格值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 C# 的 MessageBox 中获取要写入的 DataGridView 单元格值?

How can I get DataGridView cell value to be written in the MessageBox in C#?

推荐答案

您可以使用 DataGridViewCell.Value 用于检索存储在特定单元格中的值的属性.

You can use the DataGridViewCell.Value Property to retrieve the value stored in a particular cell.

因此要检索第一个"选定单元格的值并显示在 MessageBox 中,您可以:

So to retrieve the value of the 'first' selected Cell and display in a MessageBox, you can:

MessageBox.Show(dataGridView1.SelectedCells[0].Value.ToString());

以上可能不是您需要做的.如果您提供更多详细信息,我们可以提供更好的帮助.

The above probably isn't exactly what you need to do. If you provide more details we can provide better help.

这篇关于如何在消息框中获取 DataGridView 单元格值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆