很抱歉重复发布相同类型的问题,但我非常困惑
场景:我有一个数据表,可以动态地将数据填充到数据网格/运行时间,如下所示:
dt.Rows.Add(value1, value2, value3, value4, value5, value6, value6, value7, value8);
现在我在app.config
文件中有数据,我检索如下所示:
// app.config file contains string with comma separated and I am splitting it in code
string num1 = ConfigurationManager.AppSettings["crNum"];
string[] values = num1 .Split(',');
foreach (string crNum in values)
{
// I need code here to delete the entire rows where value1 == crNum
// in my above data table dt and also when I reopen/refresh
// my c# application I should not see the row deleted before.
}
最后我将数据表插入网格
myCRGrid.DataSource = dt;
我是C#的新手,我为这样一个奇怪的问题道歉。
请帮忙
谢谢!
答案 0 :(得分:0)
试试这个
#include "Ball.h"
#include "Team.h"
#include "Player.h"
extern vector<Player> team;
Ball::Ball()
: X_ball(2),
Y_ball(5)
{
current = NULL;
previous = NULL;
}
void Ball::assign(){
//vector<Player> team;
int x;
int y;
x=(team[0].getX())-X_ball;
y=(team[0].getY())-Y_ball;
int min=x+y;
int k=0;
for (int i=1; i<team.size(); i++){
x=(team[i].getX())-X_ball;
y=(team[i].getY())-Y_ball;
int sum=x+y;
if(sum<min){
k=i;
}
}
current = &team[k];
}