如何在Windows应用程序中从LinkLabel中获得DataGridview控件?下面是我正在编写的代码,它可以得到值,但不能得到LinkLabel控件。
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string name = this.dataGridView1.Rows[e.RowIndex].Cells["Name"].ToString();
LinkLabel label; //Here I need to get the linklabel control same way like value
}发布于 2022-10-08 03:58:19
通常,像LinkLabel myLinkLabel这样的控件是使用设计器添加到Winform中的控件。
因此,您将设置myLinkLabel.Text =“string”或一个变量。
或者可以动态地将控件添加到窗体中:
LinkLabel myLinkLabel = new LinkLabel();
myLinkLabel.Text = "some string";
// use other properties of myLinkLabel to set position, font, color, etc.
Controls.Add(myLinkLabel);https://stackoverflow.com/questions/73970770
复制相似问题