Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Datagrid contents to textbox

Posted on 2005-04-12
4
Medium Priority
?
290 Views
Last Modified: 2010-05-02
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...
0
Comment
Question by:DonVF
  • 3
4 Comments
 
LVL 1

Author Comment

by:DonVF
ID: 13760453
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
 
LVL 14

Accepted Solution

by:
Shiju Sasidharan earned 500 total points
ID: 13760477
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
 
LVL 1

Author Comment

by:DonVF
ID: 13760601
well..filles the textbox then errors...saying invalid row number...8(
0
 
LVL 1

Author Comment

by:DonVF
ID: 13760624
blah an on error statement fixed it hehe
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question