Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 存储要列出的值并将该列表传递给另一个窗体_C#_.net - Fatal编程技术网

C# 存储要列出的值并将该列表传递给另一个窗体

C# 存储要列出的值并将该列表传递给另一个窗体,c#,.net,C#,.net,我有两张桌子: tblUserType带列:colTypeId和colTypeName 及 tblUsers带列:colUserName,coltypeId 当用户希望从数据库中删除类型并且该类型Id正在使用(外键)时,我希望显示确认窗口,其中包含具有该类型Id的用户的信息 比如说 int exist = this.tblUsersTableAdapter1.FillByTypeId(appDataSet.tblUsers, typeId); if (exist >= 1) {

我有两张桌子:

tblUserType
带列:
colTypeId
colTypeName

tblUsers
带列:
colUserName
coltypeId

当用户希望从数据库中删除类型并且该类型Id正在使用(外键)时,我希望显示确认窗口,其中包含具有该类型Id的用户的信息

比如说

int exist = this.tblUsersTableAdapter1.FillByTypeId(appDataSet.tblUsers, typeId);
if (exist >= 1)
      {
         foreach (DataRow dr in appDataSet.tblUsers.Rows)
             {
                // string userName = dr["colUserName"].ToString();
                // show message box once but with all username (stringBuilder.Append)
                // or better, create List and pass List to another form
                // for displaying List in listbox
             }
      }
使用

变量名称列表=(来自appDataSet.tblUsers.Rows中的dr) 选择dr[“colUserName”].ToString()).ToList()

要获取姓名列表