Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.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
Vb.net 实时更新winforms visual studio 2010.net_Vb.net_Winforms_Entity Framework - Fatal编程技术网

Vb.net 实时更新winforms visual studio 2010.net

Vb.net 实时更新winforms visual studio 2010.net,vb.net,winforms,entity-framework,Vb.net,Winforms,Entity Framework,我在将数据更新到数据库后重新加载数据时遇到了一些问题。我正在从form load BindGrid()事件加载gridview。我在这里包含了我的代码 我的delcaration如下我已经尝试了这里的一切,但不能强迫它刷新网格 Dim dbContext As New R3Delivery Dim threeContext As New skechersDeliveryEntities1 Dim bs As New BindingSource Private Sub f

我在将数据更新到数据库后重新加载数据时遇到了一些问题。我正在从form load BindGrid()事件加载gridview。我在这里包含了我的代码

我的delcaration如下我已经尝试了这里的一切,但不能强迫它刷新网格

  Dim dbContext As New R3Delivery
   Dim threeContext As New skechersDeliveryEntities1
   Dim bs As New BindingSource


   Private Sub frmConfirmDeliverys_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        BindGrid()
        dgDeliverys.Columns(0).ReadOnly = True
        dgDeliverys.Columns(1).ReadOnly = True
        dgDeliverys.Columns(2).ReadOnly = True

    End Sub
    Public Sub BindGrid()
        Dim cfglocation As Int16
        cfglocation = cfb.StoreLocation

        bs.DataSource = (From u In threeContext.R3Delivery Where u.isprocessed = True AndAlso u.location = 1
                          Select u)


        bs.ResetBindings(True)
        dgDeliverys.DataSource = bs
    End Sub
我的保存按钮如下

Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
       threeContext.SaveChanges()

    BindGrid()
End Sub
我想我应该显示我的表单声明,上面的代码在我的编辑表单中,下面是我的呼叫来源

Dim frmConfirmDeliverys As New frmConfirmDeliverys
    frmConfirmDeliverys.ShowInTaskbar = False

    frmConfirmDeliverys.ShowDialog()

你试过这样做吗

dgDeliverys.Datasource=Nothing
dgDeliverys.DataSource = bs


正如jmcillhinney所说,检查您期望的数据是否通过查询返回。

感谢给我五票的人;-)首先要做的是调试代码,并检查查询是否实际检索了您认为应该检索的数据。
dgDeliverys.Refresh