| | |
Add data from an access table in a listbox
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Aug 2008
Posts: 12
Reputation:
Solved Threads: 0
Thanks babbu for that piece of code and sorry for taking so long.The problem is i dont know how to declare data table explicitly so that i can treat it as one of my variables.That is why i am using dataset, cause i get not declared error.I can't figure out how to declare my table inside my code.Struggling thanx help please!!!
Post #2 - Improper syntax. Rows collection of DataTable uses int index argument.
vb.net Syntax (Toggle Plain Text)
... colvalue=datatable.rows(0)("column_name") lstData.items.add(colvalue) ...
>Thanks again but what do i declare colValue as and datatable in order to get the expected output.
Answer is Object type.
Anothe code - DataSource bind
Answer is Object type.
vb.net Syntax (Toggle Plain Text)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dt As New DataTable dt.Columns.Add("No", GetType(Int32)) dt.Columns.Add("Name") dt.Rows.Add(1, "A") dt.Rows.Add(2, "B") dt.Rows.Add(3, "C") For Each r As DataRow In dt.Rows ListBox1.Items.Add(r("No")) Next End Sub
vb.net Syntax (Toggle Plain Text)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dt As New DataTable dt.Columns.Add("No", GetType(Int32)) dt.Columns.Add("Name") dt.Rows.Add(1, "A") dt.Rows.Add(2, "B") dt.Rows.Add(3, "C") ListBox1.DataSource = dt ListBox1.DisplayMember = "Name" ListBox1.ValueMember = "No" End Sub
![]() |
Similar Threads
- Get data from Access instead of Notepad (URGENT) (C#)
- Add data from Excel to Access Table (Visual Basic 4 / 5 / 6)
- Retreiving Data from MS Access (VB.NET)
- Add Column to Access Table with Macro (MS Access and FileMaker Pro)
- Error encountered while searching for data from access table (Visual Basic 4 / 5 / 6)
- INSERT data into access database isnt inserting data (VB.NET)
- Add Data from Access to Combo Box (Visual Basic 4 / 5 / 6)
- Importing Access Table into Execl sheet (VB.NET)
- how to add data (ASP)
Other Threads in the VB.NET Forum
- Previous Thread: send sms to mobile phone
- Next Thread: Ned codes for VB Program about Bank System
| Thread Tools | Search this Thread |
.net 2005 2008 access account arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf






