Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 25th, 2007, 04:25 PM
Registered User
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default save content combobox

Hello,

i'm new in vb and i like it a lot.
I made a small program as test for a bigger one later on with not to many script.
 i have 3 comboboxes as an array. the content of the combobox is in an .dat file on the harddrive.
when the program opens, the data is loaded from the file to the comboboxes. no problem to add data(drivers in this case as string) to combobox and file.
removing data is a problem for me. I can remove it from the comboboxes (combo1(a).removeitem) but to remove it from the file is a problem.
I figured something out to solve this.
make a savebutton (or autosave) and when the program ends with the "output" command I clear the content of the .dat file en write the new data in it.
the new data should be the entire content of the combobox and here is the problem.
How is that content called so i can print it to the file?
its not combo1(a).text or combo1(a).listindex.

does somebody know how this is called and if it works the way i figured it out?

gr Frank (the Netherlands)

 
Old September 25th, 2007, 09:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there.. Don't have VB6 here, but don't you have a list property that you can iterate???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old September 26th, 2007, 05:19 AM
Registered User
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thx gbianchi for your reply,

the problem is that vb gives an error on "combo1.list" evrytime when i try to get the data out of it.

it says "argument not optional" with ",list" in the code highlighted.



 
Old September 26th, 2007, 07:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

yes.. you have to pass the index position to it ;)

try something like:
Code:
For i = 0 To Combo1.ListCount
    strText = Combo1.List(i)
Next i
fix that code to do what you need, but the idea is to iterate all the items in the combo...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old September 26th, 2007, 08:16 AM
Registered User
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx again, and guess what, i fixed it.

i did it like this:

Dim i As Integer
Dim nieuw As String
Open "c:\Documents and Settings\TankFrank\Mijn documenten\Mijn ontvangen bestanden\Frank\winkel.dat" For Output As #4
For i = 0 To Combo1(0).ListCount - 1
nieuw = Combo1(0).List(i)
Print #4, nieuw
Next
Close #4

thx for your help






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save an web page content into RTF/text file khatu_jec ASP.NET 2.0 Professional 4 November 27th, 2007 04:52 AM
how i can save my file content into a table chandanbhakuni Classic ASP Professional 0 July 14th, 2006 07:23 AM
to save datagrid content to a excel sheet josna VB.NET 1 March 4th, 2006 07:10 AM
Choosing content depending on content of other ele dsekar_nat XSLT 1 February 27th, 2006 05:58 AM
Save Browser Content DaveGerard VBScript 0 May 27th, 2004 11:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.