Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 14th, 2003, 03:01 AM
sehiser sehiser is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toledo, OH
Posts: 14 sehiser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question ADO Listbox population & line items?

Hello,

I'm populating a listbox with data from an AS400 where each order I am pulling has mulitple line items. Here are my questions.

1. If I don't want to pull line items and only return each available order, is there a more efficient way than this?


'Field(0) would be the invoice number

Do While Not recordset.EOF
If strInvoice = recordset.Fields(0).Value Then
recordset.MoveNext
End If


2. Currently I am sending information to the list box like this:


List1.AddItem strInvoice + " " + strName + " ...


A. What is the best way to concatenate multiple vars to populate a listbox?
B. Is there a way I can fixed width format them?

3. Finally, I am keeping track of which line item I am pulling from with the RecordCount. What is the ADO syntax so I can write back to that line item if I wanted to update something in it?


Thanks,

Reply With Quote
  #2  
Old August 14th, 2003, 08:23 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
For your first question:
The best way would be not to include those in the recordset in the first place, but I do not know how complex your query is. Programming wise though, your method is good enough.

Second question:
To concatonate use the &
i.e.
str = "some" & " " & "text"

To do fixed width, you need to do two things. 1) Set the font to a fixed width type (like courier) and then use something like the Space() function to add the number of spaces that you need.

For the third question:
rs.EditMode
then change the fields you need to update
rs.Update

Reply With Quote
  #3  
Old August 15th, 2003, 01:08 AM
sehiser sehiser is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toledo, OH
Posts: 14 sehiser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks!

I was coming back to edit my question because I thought the recordset writeback might not be possible. That was only because I was thinking about SQL statements and not working with other database types.

I'll give this a shot when I get a chance. After the power outage today and just getting my high-speed internet back I'm busy catching up on things.

Basically your second response is the same as what I am doing since + and & are the same operator with different priorities. Although I see & used a lot more, I'd assume for readability.

Thanks again,

Reply With Quote
  #4  
Old August 15th, 2003, 07:35 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
As long as your open your recordset read/write and not readonly then you should be able to update it, although I typically only do updates through pure sql code myself.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > ADO Listbox population & line items?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway