开发者

How to open a frmWindow a second time wothout refreshing a grid in the first one?

I have a Window with a Grid that is making a select from MySQL, and using the .Show() function insted of ShowDialog().

I can open the same w开发者_运维知识库indow a second time to have two instances of the same window.

Now, when i open the second instance the grid populates with the new selection also in the first window. How can I make the window to open the second time without refresing the grid in it again in the first one?


If you are creating a new instance of the same form, based on the variable "myForm" from different locations, you are in effect going to "refresh" both forms.

One way to get around this is to create a second variable instance of your frmMain in a seperate function. (ie... not good at VB at all, so forgive my VB programming skills.)

In one function:

Dim myForm AS New formMain()
myForm.Show();

In a second function

Dim frmTwo AS New frmMain()
frmTwo.Show();

Then you just make your calls to frmTwo, which is the second form opened.

I hope this helps.


Form.Show is a simple function that just tells a form to unhide, it might be using the same instance hence it refreshed both.

Try this instead:

   Dim myForm As New frmMain() // Change frmMain to your forms name
   myForm.Show()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜