?
Solved

Combobox

Posted on 2003-11-04
7
Medium Priority
?
415 Views
Last Modified: 2010-05-03
hi,

This is the problem.

When I delete a combobox item from then combobox list I get an empty rule in the text file where I save the combobox list
like

item1
item2
item3

so when I delete a item

"empty rule"
item2
item3

is there a way to delete the empty space so I don't get a empty rule because other code strand on a empty rule

***
When I press the delete button
this is on a form

Private Sub Command5_Click()
Dim piet As String
On Error GoTo fout
piet = Combo1.Text
Kill piet


If Combo1.ListCount = 0 Then Exit Sub
Combo1.RemoveItem (Combo1.ListIndex)
SaveCombo1
fout:
Exit Sub
End Sub

******
This is on a module

Public Sub SaveCombo1()

Open "naam" For Output As #1

For x = 1 To Form4.Combo1.ListCount
   Print #1, Form4.Combo1.List(x)
Next
Close #1
End Sub

thanks

Eric
0
Comment
Question by:klikklik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9677329
you need to open the file, then clear the file, then write into the file.
0
 
LVL 3

Accepted Solution

by:
NBrownoh earned 200 total points
ID: 9677333
oops, i dont think thats your problem, in the code

For x = 1 To Form4.Combo1.ListCount
   Print #1, Form4.Combo1.List(x)
Next

change it to

For x = 1 To Form4.Combo1.ListCount
   Tstr$ = Form4.Combo1.List(x)
   if Tstr$ <> "" then
     Print #1, Tstr$
   end if
Next
0
 
LVL 1

Expert Comment

by:Deshin13
ID: 9677340
Why dont you have a IF THEN ELSE before that???

If Piet = " " then
   exit sub
else
  piet = Combo1.Text
  Kill piet

   If Combo1.ListCount = 0 Then Exit Sub
   Combo1.RemoveItem (Combo1.ListIndex)
   SaveCombo1
end if

exit sub
fout:
Exit Sub

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9677387
Change this line:
For x = 1 To Form4.Combo1.ListCount
to
For x = 0 To Form4.Combo1.ListCount - 1
0
 

Author Comment

by:klikklik
ID: 9677517
Thanks it works

If Piet = " " then
   exit sub
else
  piet = Combo1.Text
  Kill piet

was a try to del the empty string

but it works now

I hope that I can help YOU next time
eric
0
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9680087
dont forget to award the points
0
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9685010
cool, i didnt think i was the right answere, but thats cool.  getting 3900 expert points in 24 hours is pretty cool hehe, just started doing this almost 24 hours ago now.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question