列出要在VB.NET中列出的gridview和gridview [英] List to gridview and gridview to list in VB.NET

查看:81
本文介绍了列出要在VB.NET中列出的gridview和gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个面板中有列表视图,在其他面板中有gridview 。因此,一旦我点击向前箭头,从列​​表视图中选择的项目应该放在gridview中,反之亦然。



我试过列表列表并且工作正常。当我尝试将数据从列表绑定到gridview时,无法检索数据。



请提供建议。



如何继续使用checkedlistbox到gridview和grid to list框,我必须将网格视图数据保存到表中。

I have list view in one panel and gridview in other panel. So once I click forward arrow, the items selected from list view should get placed in gridview and vice versa.

I tried list to list and its working fine. When I try to bind data from list to gridview, unable to retrieve the data.

Please provide suggestions.

How to proceed with checkedlistbox to gridview and grid to list box and I have to save grid view data into table.




推荐答案

嗨GMRaja,

Hi GMRaja,

对不起对于我迟到的回复。

Sorry for my late reply.

你使用哪种技术?Winform或WPF或WebForm或......?

Which technology do you use? Winform or WPF or WebForm or ...?

如果是winform,到目前为止据我所知,checkedListBox只有一列而datagridview有多个,所以你想在datagridview中的哪一列绑定来自checkedListBox的数据?

If it is winform, as far as I know, checkedListBox has only one column and datagridview has more than one, so which column within datagridview do you want to bind the data from the checkedListBox?

我认为你只能绑定一列,如果是这样,请参考下面的简单演示:

I think you can only bind one column, if so, please refer to the following simple demo:

    Private Sub button1_Click(sender As Object, e As EventArgs) Handles button2.Click
        If dataGridView1.Rows.Count > checkedListBox1.SelectedIndex Then
            dataGridView1.Rows(checkedListBox1.SelectedIndex).Cells(0).Value = checkedListBox1.SelectedItem.ToString()
        Else
            dataGridView1.Rows.Add(checkedListBox1.SelectedIndex - dataGridView1.Rows.Count + 1)
            dataGridView1.Rows(checkedListBox1.SelectedIndex).Cells(0).Value = checkedListBox1.SelectedItem.ToString()
        End If
    End Sub




希望这会有所帮助!


Hope this helps!

Best此致,

Stanly


这篇关于列出要在VB.NET中列出的gridview和gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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