Results 1 to 3 of 3

Thread: Fill DataGrd with Value From Variabels

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2007
    Location
    Netherlands, Wateringen
    Posts
    24

    Fill DataGrd with Value From Variabels

    Hello everyone,

    I've the following code and try to get the value from Variabel tekst1 in Column1 from the DataGrid etc. I really won't work. I use VS 2005

    Can somebody help me with it?

    Thanks,

    E.

    Code:
    If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
    
                Dim aArtikel, bArtikel, cArtikel, dArtikel As String
                Dim r, i As Integer
                Dim Optel, Optel2 As String
                Dim tekst1, tekst2, tekst3, tekst4 As String
                Dim toevoeg
                aArtikel = Me.txtBarCode.Text
                Me.conn.Open()
                ds.Clear()
                Me.da.Fill(ds.Tables("Artikellijst"))
                r = ds.Tables("Artikellijst").Rows.Count()
                For i = 0 To r - 1
                    bArtikel = ds.Tables("Artikellijst").Rows(i).Item("EANcode")
                    cArtikel = ds.Tables("Artikellijst").Rows(i).Item("Artikel")
                    dArtikel = ds.Tables("Artikellijst").Rows(i).Item("Verkoopprijs")
                    If aArtikel = bArtikel Then
    
                        On Error Resume Next
                        tekst1 = Me.txtAantal.Text
                        tekst1 = FormatNumber(tekst1, 0)
                        tekst2 = cArtikel
                        tekst3 = dArtikel
                        tekst3 = FormatNumber(tekst3, 2)
                        tekst4 = tekst1 * dArtikel
                        tekst4 = FormatNumber(tekst4, 2)
                        toevoeg = tekst1 & vbTab & tekst2 & vbTab & tekst3 & vbTab & tekst4
    
                        DataGridView1.Rows.Add(toevoeg)
    
                        Exit For
                    End If
                Next
                Me.conn.Close()
            End If
    
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Fill DataGrd with Value From Variabels

    Please don't post the same question more than once.

    http://www.vbforums.com/showthread.php?t=487767
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2007
    Location
    Netherlands, Wateringen
    Posts
    24

    Re: Fill DataGrd with Value From Variabels

    Quote Originally Posted by jmcilhinney
    Please don't post the same question more than once.

    http://www.vbforums.com/showthread.php?t=487767
    Sorry, I didn't mean to. I'm new to the form.

    Thanks,

    E.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width