| | |
Multiple column data
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
This problem is causing me a massive headache! I'm sure I can't be the first person to do this but I have searched the internet high and low for answers about this.
I want to be able to display in a list as seperate fields:
- A product name
- Quantity on hand
- Price
It will display a long list of a couple of thousand but i would like the columns of each to line up. There must be a simple way to do this?
I am taking the data from a dataset which is reading from a access database using sql.
I would really really appreciate a reply. Thank you in advance.
I want to be able to display in a list as seperate fields:
- A product name
- Quantity on hand
- Price
It will display a long list of a couple of thousand but i would like the columns of each to line up. There must be a simple way to do this?
I am taking the data from a dataset which is reading from a access database using sql.
I would really really appreciate a reply. Thank you in advance.
This is my code. I realise there are far better ways of doing some of the things, but at the moment it is just how the logic has come out of my brain!
It should make some sense, but all the vbtab stuff is (i think) pointless coding because there must be another way of doing this!?
It should make some sense, but all the vbtab stuff is (i think) pointless coding because there must be another way of doing this!?
VB.NET Syntax (Toggle Plain Text)
Public Class stock_control Dim con As New OleDb.OleDbConnection Dim ds As New DataSet Dim da As OleDb.OleDbDataAdapter Dim sql As String Dim rnum As Single = 0 Private Sub stock_control_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = D:\computing_db_work\Signature Solutions Ltd Shop system\rory_stock.mdb" con.Open() sql = "SELECT * FROM products" da = New OleDb.OleDbDataAdapter(sql, con) 'MsgBox("Connection to Database opened") da.Fill(ds, "products") con.Close() 'MsgBox("Dataset filled") 'IN STRING! Dim tab Dim txt, txt2, txt3 Dim length, Length2, Length3, Length4 As Single rnum = 0 While ds.Tables("products").Rows(rnum).Item(0) < 1290 txt = ds.Tables("products").Rows(rnum).Item(4) length = (Len(txt)) txt2 = ds.Tables("products").Rows(rnum).Item(5) Length2 = (Len(txt2)) txt3 = ds.Tables("products").Rows(rnum).Item(6) Length3 = (Len(txt3)) Length4 = Length3 + Length2 + length ds.Tables("products").Rows(rnum).Item(27) = Length4 rnum = rnum + 1 'If Length4 = 16 Then 'MsgBox(ds.Tables("products").Rows(rnum).Item(5) & " " & ds.Tables("products").Rows(rnum).Item(4) & " " & ds.Tables("products").Rows(rnum).Item(6) & tab & ds.Tables("products").Rows(rnum).Item(26) & vbTab & ds.Tables("products").Rows(rnum).Item(11)) 'End If End While 'MsgBox("Finished") rnum = 0 While ds.Tables("products").Rows(rnum).Item(0) < 1290 If ds.Tables("products").Rows(rnum).Item(27) < 16 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 17 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 18 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 19 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 20 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 21 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 22 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 23 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 24 Then tab = vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 25 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 26 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 27 Then tab = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 28 Then tab = vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 29 Then tab = vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 30 Then tab = vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 31 Then tab = vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 32 Then tab = vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 33 Then tab = vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 34 Then tab = vbTab & vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 35 Then tab = vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 36 Then tab = vbTab & vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 37 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 38 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 39 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 40 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 41 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 42 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 43 Then tab = vbTab & vbTab ElseIf ds.Tables("products").Rows(rnum).Item(27) < 44 Then tab = vbTab & vbTab End If lb_stock.Items.Add(ds.Tables("products").Rows(rnum).Item(5) & " " & ds.Tables("products").Rows(rnum).Item(4) & " " & ds.Tables("products").Rows(rnum).Item(6) & tab & ds.Tables("products").Rows(rnum).Item(26) & vbTab & ds.Tables("products").Rows(rnum).Item(11)) rnum = rnum + 1 tab = "" End While End Sub
![]() |
Similar Threads
- updating multiple columns in single MySQL table (PHP)
- [IRowsetFastLoad insertions for multiple columns] (C++)
- Read multiple column data from SQL query ( 1 row ) (ASP.NET)
- How do I populate multiple column list box? (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: Deleting record from mutiple tables
- Next Thread: How to inherit windows form that contain controls
| Thread Tools | Search this Thread |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






