将新列添加到DataGridView控件

时间:2019-04-15 16:44:42

标签: vb.net winforms datagridview

我有一个文本文件中带有DataSource的DataGridView

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *identity = @"CommentTableViewCell";
    CommentTableViewCell *cell = (CommentTableViewCell *)[tableView dequeueReusableCellWithIdentifier:identity];
    if(cell == nil){
        @try {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CommentTableViewCell" owner:self options:nil];
            cell = [nib objectAtIndex:0];
        }
        @catch (NSException *exception) {
            NSLog(@"Err:%@", exception.reason);
        }
        @finally {

        }

    }

现在我需要从数据库中添加另一列,我对此有很多问题。
添加时,它会自动显示在第一列下,而我想将其添加为DataGridView中间的新列。

我的代码就是这样:

If ouvrir.ShowDialog = DialogResult.OK Then  
    Dim sr As New StreamReader(ouvrir.FileName)  
    While Not sr.EndOfStream  
        datagridview1.Rows.Add(sr.ReadLine.Split(CChar(vbTab)))  
    End While 
End If

0 个答案:

没有答案
相关问题