adding items to list box control from a dataset

in this code the lstall.items.add  generate error

Argument not specified for parameter item??  


          If txtGroup.Text <> "" Then
                lstAllSem.Items.Clear()
                lstSelSem.Items.Clear()
                txtGroup.Text = Replace(txtGroup.Text, "'", "''")
                lstallAdp = New SqlDataAdapter("select * from meet_master where muf_8 = '" & txtGroup.Text & "'", sqlCnn)
                Try
                    lstallAdp.Fill(da)
                Catch ex As Exception
                End Try
                If da.Tables(0).Rows.Count = 0 Then
                    '            MsgBox("No program group available. Selection of other Seminars  not possible.. Continue?", vbYesNo)
                Else
                    Dim dta As DataTable
                    Dim dro As DataRow
                    dta = da.Tables(0)

                    For Each dr0 In dta.Rows

                        lstAllSem.Items.Add = da.Tables(0).Rows(0)("meeting").ToString()
                    Next dr0

                    dta.Dispose()

                End If

            End If

Open in new window



Any help greatly appreciated.
Larry RungrenDirector of TechnologyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Najam UddinCommented:
da.Tables(0).Rows(0).Item("meeting").ToString()
Rgonzo1971Commented:
Hi,

pls try

 lstAllSem.Items.Add = dr0.Item("meeting").ToString()

Open in new window


Regards
Fernando SotoRetiredCommented:
I think this is what you are looking for.
lstAllSem.Items.Add = dr0("meeting").ToString()

Open in new window

Webinar: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. Join us in our upcoming webinar as we discuss how to best defend against these attacks!

Larry RungrenDirector of TechnologyAuthor Commented:
Thanks for the speedy responses but all three options generate the same error!!
Larry RungrenDirector of TechnologyAuthor Commented:
Dot net certainly has been a major step backwards in the development cycle.  I have found so many things that were done in 3 or 4 lines of code now require 40 -50 lines with all sorts of hidden methods and layered access techniques.  Kinda like going back to proprietary OS's that had massive function libraries that took months if not years to truly master.  Typical MSFT move forward, but cut off the past completely, and the time and expense for the move is ours to swallow, Just my opinion.
Jacques Bourgeois (James Burger)PresidentCommented:
You have it in reverse. Most of the time, .NET enables you to do things with far fewer lines of code. When you end up using more code to do something in .NET that you did in VB6, it's because you do not use .NET correctly.

In your code for instance, you declare a variable dta, initialize it and Dispose of it, but never use it because you go through the DataSet to reference your table.

You declare a DataRow but never use it.

You are using a DataSet when you have only one table. DataSet are used when you have many DataTable objects linked together with DataRelation objects. See my article on the subject.

You call a query that retrieves all the fields from your database table, but you use only one of these fields. The following would be sufficient to fill the ListBox:

... 
lstallAdp = New SqlDataAdapter("select meeting from meet_master where muf_8 = '" & txtGroup.Text & "'", sqlCnn)
lstallAdp.Fill(da)
...
lstAllSem.DataSource=da.Tables(0)
lstAllSem.DisplayMember="meeting"

Open in new window


And usually a DataReader is a lot better choice than a DataAdapter when you need to fill a ListBox or a ComboBox and need only one field. Once again, give a look at my article.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Larry RungrenDirector of TechnologyAuthor Commented:
Jacques Bourgeois (James Burger)

Sorry if I seem negative.. First major conversion and what was second nature,  16 years VB4-6, is seemingly a different universe with no real easy path upward.  Documentation is sketchy at best and most  sample processes I can find seem to relate to gridview options.  A true desktop, data entry process sample seems to be lacking.  I've made great headway, and the only hangup is connecting existing Crystal Reports 2011 report to vb2010 without rewriting them.  I have 14 reports in this app that ran fine under VB6, but that is for another day.
Larry RungrenDirector of TechnologyAuthor Commented:
Thanks for the help and the smack back to reality.
Jacques Bourgeois (James Burger)PresidentCommented:
I understand your frustrations. I went through them too at the beginning of the century, having used VB from VB2 to VB6, and training other programmers from VB3 to VB6.

But keep with it. VB.NET is a far better environment and language than VB6 was. There might be a few things that take a few lines of code more than before. But they are a small fee for what usually ends up as more performance and security (although security is often frustating in .NET). And expect to write a lot less code. In the 10,000+ classes of the framework, there is almost always a method somewhere that will do what you want to do. You just need to take the time to look for it.

It took me 60 lines of codes in VB6 to retrieve the format of the date, as set in the Control Panel, in a bilingual environment. Around 20 for the number format. It takes only 1 line for each once you have discovered the System.Globalization namespace. Try to get the date a file was created or last opened without being written to in VB6. A one line thing again in .NET.

You might find that working with database involves a little more, and it does, but not much once you get your ways with the System.Data namespace. Up to 2 years ago, I was still stuck with unfrequent maintenance with old VBA code in Microsoft Access, and I missed ADO.NET almost everytime I had to go back to Recordsets. Start doing web or mobile development, and you will understand and appreciate even more the new ways of doing database stuff, and that you do not have to learn new techniques. ADO.NET is the same way no matter the type of application.

Get used to the documentation too. It is a lot better than it was in VB6. It's just that it is so huge that it takes a while before you grab the proper ways to use it. Install the local help that is not installed by default and use it as your first source instead of online help. Local help can be adapted to what you do. If you do not do Web development, do not install the web modules and they won't show up when you search. And the local help has an Index, something that is really lacking with online help, where the only way to go is through search. When you need to search outside of the tools that Visual Studio link you with, use Bing instead of Google. Bing being a Microsoft thing, they have a tendency to emphasize their own products. I find that you usually find information about Microsoft tools and apllications more easily on Bing than when you go through Google, that makes its money by throwing in stuff for companies that paid to get moved up the result of a search.

As for Crystal Report, well... it's Crystal Report. Don't blame .NET. Blame the 101 companies who worked on Crystal Report since it's inception, and who have never completely nailed it. And still don't, even if .NET has been officially around for more than 13 years.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Security

From novice to tech pro — start learning today.