在母版页系统中同时调用两个形式挂起 [英] calling two form same time in master page system getting hanging
问题描述
我正在使用Windows窗体应用程序,
i有两个窗口form.in两种形式我使用后台工作者和计时器..我的表单代码之一如下:
i am working on windows form application,,
i have two windows form.in both form i am using background worker and timer..one of the my form code like this:
sub filldgv
Dim dt As New DataTable
dt.Columns.Add("Tbarcode", GetType(String))
dt.Columns.Add("PlateNo", GetType(String))
dt.Columns.Add("Driver", GetType(String))
dt.Columns.Add("KeyTime", GetType(Integer))
dt.Columns.Add("DelTime", GetType(Integer))
Dim bgw As New BackgroundWorker()
AddHandler bgw.DoWork, Sub() Populate(dt)
AddHandler bgw.RunWorkerCompleted, Sub()
DGVReleased.AutoGenerateColumns = True
DGVReleased.DataSource = dt
DGVReleased.Columns(0).Width = 120
DGVReleased.Columns(1).Width = 65
DGVReleased.Columns(2).Width = 65
DGVReleased.Columns(3).Width = 65
DGVReleased.Columns(4).Width = 65
Call changecolor()
End Sub
bgw.RunWorkerAsync()
end sub
Sub Populate(ByVal dt As DataTable
Using reader As TextReader = File.OpenText("C:\Program Files\IBS\login.txt")
txtvalue = Integer.Parse(reader.ReadLine())
End Using
Glocid = txtvalue
Dim cmd = New SqlCommand("IBS_fetchreleasedinpodiumgrid")
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = con.connect
cmd.Parameters.Add("@locid", SqlDbType.Int).Value = Glocid
Dim dr = cmd.ExecuteReader
While dr.Read
DGVReleased.AutoGenerateColumns = True
Dim o = {dr("TBarcode").ToString(),
dr("PlateNo").ToString(),
dr("DelEcode").ToString(),
If(IsDBNull(dr("KRRT")), 0, dr("KRRT")),
If(IsDBNull(dr("DT")), 0, dr("DT"))}
dt.Rows.Add(o)
End While
dr.Close()
con.disconnect()
End Sub
此表单名称为frmreleased ,,和另一个名称frmreq uested..this表格也有这样的代码..在表格大师我称之为两种形式..同时...就像这样:
this form name is frmreleased,,and another form name frmrequested..this form also having code like this..in form master i am calling this two forms..same time..like this:
frm8= New frmreleased
frm8.Location = New Point(375, 399)
frm8.MdiParent = Me
frm8.Show()
frm9 = New frmrequested
frm9.Location = New Point(996, 399)
frm9.MdiParent = Me
frm9.Show()
但是在增加数据的同时网格视图我的系统挂起......我正在使用back grounder和timer两种形式..我可以运行我的应用程序而不需要挂起系统..
but while increasing data in the grid view my system is hanging...i am using back grounder and timer both forms..how i can run my application without hanging the system..
推荐答案
这篇关于在母版页系统中同时调用两个形式挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!