Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

VS 2010 Enumeration Error 2 Part

$
0
0
Hello to all, I am back with interesting figure out of Enumeration Error:

Name:  Capture.JPG
Views: 26
Size:  41.8 KB

Error shows because I have two forms. In first I have simple data set inputs - e.g. contact information, Name, Addres, phone numer - here you can put new contact, update, delete etc. Then! I have second form, where I can only update this form 1 (I can't put new). Because of this error of Enumeration shows. I have tested, I have deleted this function in this second form, and Enumeration error did not shown.

Does anyone have idea, how to create Second form to update this first corectly. Here is my code of second form:

Code:

    Private Sub Update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update.Click
        Dim txt() As TextBox = {IDARTIKLA, TextArtikel, TextKolicinaArtikel, TextCenaArtikel}
        Dim a As Integer = 0
        Dim flag As Integer = 0

        While a < txt.Length And flag = 0
            If txt(a).Text = String.Empty Then
                flag = 1
            End If
            a += 1
        End While
        If flag Then
            MsgBox("You chose nothing")
        Else

            Try
                Me.ArtikliPodjetjaTableAdapter.ZmZalogo(Me.BazaRacunko.ArtikliPodjetja, CType(IDARTIKLA.Text, Integer))
            Catch ex As System.Exception
                System.Windows.Forms.MessageBox.Show(ex.Message)
            End Try
            ZalogaArtikla.Text = ZalogaTextBox.Text
            TextZaloga.Text = TextKolicinaArtikel.Text

            Dim kolArtikel As Decimal
            Dim zalArtikla As Decimal
            Dim zalOdstej As Decimal

            kolArtikel = CDec(TextZaloga.Text)
            zalArtikla = CDec(ZalogaArtikla.Text)

            zalOdstej = (zalArtikla - kolArtikel)
            ZalogaTextBox.Text = zalOdstej

        End If

    End Sub
    Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click

            Me.Validate()
            Me.ArtikliPodjetjaBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.BazaRacunko)

    End Sub

In my TableAdapterManager in Update Order I have in both forms set to InsertUpdateDelete

Any ideas? Thanks in front
Attached Images
 

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>