hi! I wanted to know if there's any VB control which you can use as a table. I want to sort the value of different variables from biggerst to smallest. Does anyone know an easy way to do this? Thanks in advance,
Alexander McAndrew
Printable View
hi! I wanted to know if there's any VB control which you can use as a table. I want to sort the value of different variables from biggerst to smallest. Does anyone know an easy way to do this? Thanks in advance,
Alexander McAndrew
If you're talking about to show the data from the table in your VB application then you can use an SQL statement to specify the order.
Select * From MyTable Order By Column1 Desc
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-16-1999).]
thanks, but how can I create a table and add things to it during run-time? Should I use an excel chart? Or is their a VB control I can use? Thanks in advance,
Alexander McAndrew
You can use any controls that suites your needs. For example, lets say you have a table called Customer. So the table Customer structure will look something like this:
Fields
CustID - Autonumber
CustFName - Text
CustLName - Text
Address - Text
City - Text
State - State
Zip - Text
Phone - Text
So, the best way is to create a control array of TextBoxes. So, lets say we have a contols array named txtInfo (7 textboxes)
And now we want to save the info you typed in the textboxes (the CustID will be created automatically). Also, in this sample I assume that the database is an Access database.
Code:Dim db As Database
Dim rs As Recordset
Dim i As Integer
Set db = Workspaces(0).OpenDatabase("D:\Microsoft Visual Studio\VB98\Nwind.mdb")
Set rs = db.OpenRecordset("Customer", dbOpenTable)
rs.AddNew
For i = 0 To txtInfo.UBound
rs(i + 1) = txtInfo(i)
Next
rs.Update
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-16-1999).]