DataView?

  • Thread starter Thread starter Able
  • Start date Start date
A

Able

Dear friends

A listbox on a Form1 is in the Form1.Load event filled with items from a
DataView. If I then hide the form and show it again all the items in the
listbox is duplicated. I dont know what causes this behaviour and didnt
believe the Form1 load event was fired again when showing the Form1 after
hiding. Do I have to erase the DataView before showing the form again and if
so how do I do this?

Somebody knows?

Regards Able
 
Hi Able,

This sounds strange, can you send some piece of code
(only the par from the page load and the hide and please first copied it to
a notebook and then copied and pasted back in the mail).

Maybe we can help you then.

Cor
 
Found this solution:

"Public Class MainClass
Public Shared Sub Main()
FirstForm = New Form1()
SecondForm = New Form2()
FirstForm.Show()
Application.Run()
End Sub

Private Shared m_FirstForm As Form1
Private Shared m_SecondForm As Form2

Public Shared Property FirstForm() As Form1
Get
Return m_FirstForm
End Get
Set(ByVal Value As Form1)
m_FirstForm = Value
End Set
End Property

Public Shared Property SecondForm() As Form2
Get
Return m_SecondForm
End Get
Set(ByVal Value As Form2)
m_SecondForm = Value
End Set
End Property
End Class
///

Set your project's startup object to MainClass.

Use this code to switch between the 2 forms:

\\\
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles Button1.Click
MainClass.FirstForm.Hide()
MainClass.SecondForm.Show()
End Sub
///

You can use Application.Exit to shut down your application.

Notice that the way described above is only one possible solution...

Regards,
Herfried K. Wagner"
 
Hi Able,

With that goes everything fine, I added this code in the load event of form1

Me.TextBox1.Text = Me.TextBox1.Text & "A"

This would mean, if I had that effect of, you that there would be after a
while a lot of A's but there was only one.

So this is not the problem.

Cor
 
Back
Top