Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

VS 2010 how to add mysql data into button using loop ?

$
0
0
hi,

I'm doing some app that I need to put mysql data into my button name

example i have 3 mysql data

data1, data2, data3

then i use some like this, to change my button name

Code:

For Each btn As Control In Me.Controls
            If TypeOf btn Is Button Then
                For i = 0 To tables.Rows.Count - 1
                    btn.Text = tables.Rows(i)("dataName")
                Next
            End If
        Next

but what i got is just the last data for all my button.

I can get it works but I have to put 1 by 1, that if i have a new record in database i have to put it manually, something like this

Code:

button1.text =  tables.Rows(0)("dataName")
button2.text =  tables.Rows(1)("dataName")
button3.text =  tables.Rows(2)("dataName")

I want to make my button become data1, data2, and data3 using loop, is it possible ? please help me..

Viewing all articles
Browse latest Browse all 42220

Trending Articles



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