Home > Net >  How to put the dataGridView name passed as a parameter to another function?
How to put the dataGridView name passed as a parameter to another function?

Time:10-11

I taught myself C # entry, only a little bit of C foundation, now want to piece together a program that directly dataGridView function is derived by using https://www.cnblogs.com/hfzsjz/archive/2013/05/07/3064231.html here the complete code, because I'm WinForm form needs to have multiple interfaces in dataGridView export function, want to change the code contained in the links above to functions, use place pass dataGridView name as a parameter to it, under the guidance of how to do it, please. Thank you,

//write title
for (int i=0; i dataGridView1 . ColumnCount; I++)
{
If (I & gt; 0)
{
STR +="\ t";
}
STR += dataGridView1 . The Columns [I] the HeaderText;
}

Red font is to replace the function of parameters,

CodePudding user response:

This let me how to answer: why do you want to pass the string? Direct transmission control?
Besides the normal logic should be inherited their control and then give their control method of defining a common mygrid directly and use it every time. The export

CodePudding user response:

Baidu "c # extension method"

CodePudding user response:

reference 1st floor qq_30335331 response:
this let me how to answer: why do you want to pass the string? Direct transmission control?
Besides the normal logic should be inherited their control and then give their control method of defining a common mygrid directly and use it every time. The export


How do I transfer control? Is what all can't, just write command line before small C program, so I still stay in window procedure is simple function parameters of cognitive stage, baidu for a long time, even in the bing search English also didn't find a way, may be I didn't want this way people use it,

reference 1st floor qq_30335331 response:
this let me how to answer: why do you want to pass the string? Direct transmission control?
Besides the normal logic should be inherited their control and then give their control method of defining a common mygrid directly and use it every time. The export


Thank you, just saw your reply, I think I'm so low, so no one acknowledges the problem, I finally find a way on the Internet in the afternoon, as you said when I was in the function definition parameters should be directly using DataGridView type, before I don't know how the control variables of type, I use the link method can solve the problem of the original, would like to ask how to inherit their own controls defined public methods? I checked the didn't understand,
https://www.cnblogs.com/sydeveloper/archive/2012/03/19/2406558.html
  •  Tags:  
  • C#
  • Related