Datagrid contents to textbox

I have a datagrid that is retuirning some email addresses from a postgresql database...
I need to take the datagrid contents and copy it to a textbox on the form...only seperating each address with a comma...form mails these users...

My question is how do I get each row into a textbox? seperated by a comma?

like
datgrid control looks like this
blah@blah.com
me@me.com
john@john.com

I want to put that in a textbox like:
blah@blah.com, me@me.com,john@john.com

Thanks...
LVL 1
DonVFAsked:
Who is Participating?
 
Shiju SasidharanAssoc Project ManagerCommented:
try this

'=================================
Private Sub FillTextBox(ColumnIndex As Integer)
    Dim i
    Text1.Text = ""
    For i = 0 To DataGrid1.ApproxCount - 1
        DataGrid1.row = i
        DataGrid1.col = column
        DataGrid1.Refresh
        If Text1.Text = "" Then
            Text1.Text = DataGrid1.Text
        Else
            Text1.Text = Text1.Text & ", " & DataGrid1.Text
        End If
    Next i
End Sub

Private Sub Command1_Click()
'    To get first column
     Call FillTextBox(0)
     
'       To get Second column
'       Call FillTextBox(1)
End Sub
'==========================

;-)
Shiju
0
 
DonVFAuthor Commented:
Or better yet....
Why the heck won't this work?

Dim rscount As Integer
rscount = adoPrimaryRS.RecordCount

For i = 0 To rscount
  Text1.Text = Text1.Text & adoPrimaryRS(i) & "," <---getting error on this line shown below
Next i

End Sub

Everything is there and it counts correctly...and can return emails...

The error is:
Runtime error 3265
Item can not be found in the collection corresponding to the requested name or ordinal.


0
 
DonVFAuthor Commented:
well..filles the textbox then errors...saying invalid row number...8(
0
 
DonVFAuthor Commented:
blah an on error statement fixed it hehe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.