如何将文本框添加到C#Windows窗体中的dataGridViev.Rows [i] .Cells [i]? [英] How to add textbox to dataGridViev.Rows[i].Cells[i] in C# Windows Forms?

查看:110
本文介绍了如何将文本框添加到C#Windows窗体中的dataGridViev.Rows [i] .Cells [i]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#asp.net中使用 gridView.Rows [i] .Cells [i] .Controls.Add(textboxname);

It was very simple in C# asp.net with gridView.Rows[i].Cells[i].Controls.Add(textboxname);

但是C#Windows Forms的单元格中没有 .Controls 。我试过使用DataGridViewTextBoxCell类型,但它不是一个完全TextBox。我需要将自己的文本框放入单元格中。我该怎么办?

But there is no .Controls in C# Windows Forms' Cells. I've tried to use DataGridViewTextBoxCell type but it is not an exactly TextBox. I need to put my own textbox into a cell. How do I do?

推荐答案

有一个DataGridViewTextBoxColumn类您可以用来托管DataGridViewTextBoxCell单元格的集合:

https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewtextboxcolumn(v=vs.110).aspx

如果这对您不够好,您可以创建自己的自定义DataGridViewColumn类型。有关详细信息,请参阅以下页面。

If this isn't good enough for you, you could create your own custom DataGridViewColumn type. Please refer to the following page for more information.

如何:Windows窗体DataGridView单元格中的主机控件:
https://msdn.microsoft.com/en-us/library/7tas5c80%28v=vs.110 %29.aspx

希望有所帮助。

请记住通过将有用的帖子标记为答案来关闭您的主题,然后开始如果您有新问题,可以使用新主题。请不要在同一个帖子中提出几个问题。

Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.


这篇关于如何将文本框添加到C#Windows窗体中的dataGridViev.Rows [i] .Cells [i]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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